]> git.madduck.net Git - code/gsc.git/blob - examples/nsd/Makefile

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

remove/reserve unused ssh_opts parameter
[code/gsc.git] / examples / nsd / Makefile
1 #!/usr/bin/make -f
2 #
3 # Makefile — gsc example for nsd
4 #
5 # An example Makefile usable to manage nsd in the context of gsc.
6 #
7 # Copyright © 2014 martin f. krafft <madduck@madduck.net>
8 # Released under the terms of the Artistic Licence 2.0
9 #
10
11 HOSTNAME = $(shell hostname --fqdn)
12 PARAMS_FILE = $(wildcard ./params_$(HOSTNAME))
13
14 ifeq ($(PARAMS_FILE),)
15 $(error No parameters file found for host $(HOSTNAME))
16 endif
17
18 .PHONY: update
19 update: .sentinel fixperms
20 .sentinel: .git/index Makefile nsd.conf zones.conf
21         @. $(PARAMS_FILE) \
22         && echo "$$NSD_REBUILD_COMMAND" && $$NSD_REBUILD_COMMAND \
23         && echo "$$NSD_RESTART_COMMAND" && $$NSD_RESTART_COMMAND
24         @touch $@
25
26 fixperms: ALWAYS
27         chmod -R o= .
28         setfacl -R -m group:nsd_update:rX,default:group:nsd_update:rX .
29         setfacl -R -m default:mask::rX,default:group::rX .
30         setfacl -R -m user:nsd:rX,default:user:nsd:rX .
31 .PHONY: fixperms
32
33 git_pull:
34         git pull
35
36 ALWAYS:
37 %.conf: %.conf-generator ALWAYS
38         @rm -f .$@.tmp && umask 0337 && ./$< $(PARAMS_FILE) > .$@.tmp
39         @[ -e $@ ] || touch $@
40         @cmp --quiet .$@.tmp $@ || \
41                 { chmod 600 $@ && mv .$@.tmp $@ && echo $@ updated. ; }
42         @rm -f .$@.tmp