Modification : vm_hosted -> etc/sv/*/configure.sh .
[lhc/ateliers.git] / etc / sv / nsd3 / configure.sh
1 rule apt_get_install nsd
2 rule insserv_remove nsd3
3 sudo rm -rf \
4 /etc/nsd3/zone.d
5 sudo install -d -m 750 -o root -g nsd \
6 /etc/nsd3/zone.d
7 {
8 cat <<-EOF
9 server:
10 ip-address: $vm_ipv4
11 ip4-only: yes
12 EOF
13 cat "$tool"/etc/nsd3/nsd.conf
14 local conf
15 for conf in "$tool"/etc/nsd3/zone.d/*.conf
16 do conf=${conf#"$tool"/etc/nsd3/zone.d/}
17 local domain=${conf%.conf}
18 if test -e "$tool"/etc/nsd3/zone.d/"$domain".zone.m4
19 then m4 \
20 --define=ZONE_DOMAIN=$domain \
21 --define=ZONE_SERIAL=$(cd "$tool" && git log -1 --format="%ct" -- etc/nsd3/zone.d/"$domain".zone.m4) \
22 --define=VM_IP4=$vm_ipv4 \
23 "$tool"/etc/nsd3/zone.d/"$domain".zone.m4
24 else cat "$tool"/etc/nsd3/zone.d/"$domain".zone
25 fi |
26 sudo install -m 440 -o root -g nsd /dev/stdin \
27 /etc/nsd3/zone.d/"$domain".zone
28 sudo install -m 440 -o root -g nsd \
29 "$tool"/etc/nsd3/zone.d/"$conf" \
30 /etc/nsd3/zone.d/"$conf"
31 cat <<-EOF
32 zone:
33 name: $domain
34 zonefile: /etc/nsd3/zone.d/$domain.zone
35 EOF
36 done
37 } |
38 sudo install -m 640 -o root -g nsd /dev/stdin \
39 /etc/nsd3/nsd.conf
40 sudo nsdc rebuild