b05c73e442b3aa4ce7afdba4b6d4e67e57b2c4f1
[lhc/ateliers.git] / etc / sv / nsd3 / local.sh
1 "$tool"/local/apt-get-install nsd
2 "$tool"/local/insserv-remove nsd3
3
4 sudo install -d -m 750 -o root -g nsd \
5 /etc/nsd3/zone.d
6 {
7 cat <<-EOF
8 server:
9 ip-address: $vm_ipv4
10 ip4-only: yes
11 EOF
12 cat "$tool"/etc/nsd3/nsd.conf
13 for zone in $(find "$tool"/etc/nsd3/zone.d \
14 -mindepth 1 -maxdepth 1 -type f \
15 -false ${@:+$(printf -- '-or -name %s.conf\n' "$@")} \
16 -printf '%f\n')
17 do zone=${zone%.conf}
18 if test -e "$tool"/etc/nsd3/zone.d/"$zone".zone.m4
19 then m4 \
20 --define=ZONE_DOMAIN=$zone \
21 --define=ZONE_SERIAL=$(cd "$tool" && git log -1 --format="%ct" -- etc/nsd3/zone.d/"$zone".zone.m4) \
22 --define=VM_IP4=$vm_ipv4 \
23 "$tool"/etc/nsd3/zone.d/"$zone".zone.m4
24 else cat "$tool"/etc/nsd3/zone.d/"$zone".zone
25 fi |
26 sudo install -m 440 -o root -g nsd /dev/stdin \
27 /etc/nsd3/zone.d/"$zone".zone
28 cat <<-EOF
29 zone:
30 name: $zone
31 zonefile: /etc/nsd3/zone.d/$zone.zone
32 $(cat "$tool"/etc/nsd3/zone.d/"$zone".conf)
33 EOF
34 done
35 } |
36 sudo install -m 640 -o root -g nsd /dev/stdin \
37 /etc/nsd3/nsd.conf
38
39 "$tool"/local/runit-sv-start "$sv"
40 sudo nsdc rebuild
41 sudo nsdc reload
42 #sudo nsdc notify