#!/usr/bin/make -f # # Makefile — gsc example for nsd # # An example Makefile usable to manage nsd in the context of gsc. # # Copyright © 2014 martin f. krafft # Released under the terms of the Artistic Licence 2.0 # HOSTNAME = $(shell hostname --fqdn) PARAMS_FILE = $(wildcard ./params_$(HOSTNAME)) ifeq ($(PARAMS_FILE),) $(error No parameters file found for host $(HOSTNAME)) endif .PHONY: update update: .sentinel fixperms .sentinel: .git/index Makefile nsd.conf zones.conf @. $(PARAMS_FILE) \ && echo "$$NSD_REBUILD_COMMAND" && $$NSD_REBUILD_COMMAND \ && echo "$$NSD_RESTART_COMMAND" && $$NSD_RESTART_COMMAND @touch $@ fixperms: ALWAYS chmod -R o= . setfacl -R -m group:nsd_update:rX,default:group:nsd_update:rX . setfacl -R -m default:mask::rX,default:group::rX . setfacl -R -m user:nsd:rX,default:user:nsd:rX . .PHONY: fixperms git_pull: git pull ALWAYS: %.conf: %.conf-generator ALWAYS @rm -f .$@.tmp && umask 0337 && ./$< $(PARAMS_FILE) > .$@.tmp @[ -e $@ ] || touch $@ @cmp --quiet .$@.tmp $@ || \ { chmod 600 $@ && mv .$@.tmp $@ && echo $@ updated. ; } @rm -f .$@.tmp