# MPD VPN # # Douglas Thrift # # $Id$ SHELL := $(shell which bash) host := $(shell hostname -s) generate := ipsec.conf mpd.conf psk.txt rc.conf recon.dat all: $(addprefix $(host)/,$(generate)) $(host)/ipsec.conf $(host)/rc.conf: $(host)/recon.dat recon.sh ./recon.sh -dat=$< -$(patsubst %.conf,%,$(notdir $@))=$@ -conf=$(patsubst %.conf,%,$(notdir $@)) $(host)/mpd.conf: network.xml pptp.xsl saxon -o $@ $< $(word 2,$+) host=$(host) generated=$(realpath $(word 2,$+)) $(host)/psk.txt: $(host)/recon.dat recon.sh ./recon.sh -dat=$< -psk=$@ -conf=psk $(host)/rc.conf: recon.xsl $(host)/recon.dat: network.xml ipsec.xsl saxon -o $@ $< $(word 2,$+) host=$(host) .PHONY: install clean install: all ./mpd.pl $(host)/mpd.conf /usr/local/etc/mpd5/mpd.conf ifeq ($(shell cat ~/.mpd-nsupdate.key 2> /dev/null),) install -pv -g wheel -m 0600 -o root /dev/null ~/.mpd-nsupdate.key . mpd-common.sh; echo $$name $$secret > ~/.mpd-nsupdate.key endif install -pv -m 0644 mpd-common.sh ~/bin/mpd-common.sh install -pv -m 0644 $(host)/recon.dat ~/.recon.dat install -pv mpd-up.sh mpd-down.sh recon.sh ~/bin clean: -rm -f $(host)/*