# DNS # # Douglas Thrift # # $Id$ SHELL := $(shell which bash) update := $(shell hostname -s) ifeq ($(shell [[ -r $(update) ]]; echo $$?),0) dhclient_exit_hooks := dhclient-exit-hooks endif .PHONY: all install clean all: $(dhclient_exit_hooks) dhclient-exit-hooks: dhclient-exit-hooks.in $(update) sed -e "s/^%%hostname%%$$/hostname='$(shell cat $(word 2, $+))'/;s/^%%\([a-z]*\)%%$$/read -p '\1: ' -er \1/" $< > $@ install: all ifndef dhclient_exit_hooks install -pv -g wheel -o root reverse.pl ~root/bin/reverse.pl else install -pv -g wheel -m 0600 -o root /dev/null /etc/dhclient-exit-hooks sed -e "s/^read -p '\(key\): ' -er \1$$/\1='$(shell read -p 'key: ' -er; echo $$REPLY)'/;s/^read -p '\(secret\): ' -er \1$$/\1='$(shell read -p 'secret: ' -er; echo $$REPLY)'/" dhclient-exit-hooks > /etc/dhclient-exit-hooks endif clean: rm -f dhclient-exit-hooks