Correction : nsd3 : ne perd pas les configurations des zones.
[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: $local_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 -printf '%f\n')
16 do zone=${zone%.conf}
17 if test -e "$tool"/etc/nsd3/zone.d/"$zone".zone.m4
18 then m4 \
19 --define=ZONE_DOMAIN=$zone \
20 --define=ZONE_SERIAL=$(cd "$tool" && git log -1 --format="%ct" -- etc/nsd3/zone.d/"$zone".zone.m4) \
21 --define=LOCAL_IP4=$local_ipv4 \
22 "$tool"/etc/nsd3/zone.d/"$zone".zone.m4
23 else cat "$tool"/etc/nsd3/zone.d/"$zone".zone
24 fi |
25 sudo install -m 440 -o root -g nsd /dev/stdin \
26 /etc/nsd3/zone.d/"$zone".zone
27 cat <<-EOF
28 zone:
29 name: $zone
30 zonefile: /etc/nsd3/zone.d/$zone.zone
31 $(cat "$tool"/etc/nsd3/zone.d/"$zone".conf)
32 EOF
33 done
34 } |
35 sudo install -m 640 -o root -g nsd /dev/stdin \
36 /etc/nsd3/nsd.conf
37
38 "$tool"/local/runit-sv-start "$sv"
39 sudo nsdc rebuild
40 sudo nsdc reload
41 #sudo nsdc notify