X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=etc%2Fsv%2Fnsd3%2Flocal.sh;fp=etc%2Fsv%2Fnsd3%2Flocal.sh;h=b05c73e442b3aa4ce7afdba4b6d4e67e57b2c4f1;hb=3ad6118386977e346d81042e924e5db9c5f15b7d;hp=0000000000000000000000000000000000000000;hpb=22f04b9fac14adc3d3fc98273ba126c3a51792c3;p=lhc%2Fateliers.git diff --git a/etc/sv/nsd3/local.sh b/etc/sv/nsd3/local.sh new file mode 100644 index 0000000..b05c73e --- /dev/null +++ b/etc/sv/nsd3/local.sh @@ -0,0 +1,42 @@ +"$tool"/local/apt-get-install nsd +"$tool"/local/insserv-remove nsd3 + +sudo install -d -m 750 -o root -g nsd \ + /etc/nsd3/zone.d +{ + cat <<-EOF + server: + ip-address: $vm_ipv4 + ip4-only: yes + EOF + cat "$tool"/etc/nsd3/nsd.conf + for zone in $(find "$tool"/etc/nsd3/zone.d \ + -mindepth 1 -maxdepth 1 -type f \ + -false ${@:+$(printf -- '-or -name %s.conf\n' "$@")} \ + -printf '%f\n') + do zone=${zone%.conf} + if test -e "$tool"/etc/nsd3/zone.d/"$zone".zone.m4 + then m4 \ + --define=ZONE_DOMAIN=$zone \ + --define=ZONE_SERIAL=$(cd "$tool" && git log -1 --format="%ct" -- etc/nsd3/zone.d/"$zone".zone.m4) \ + --define=VM_IP4=$vm_ipv4 \ + "$tool"/etc/nsd3/zone.d/"$zone".zone.m4 + else cat "$tool"/etc/nsd3/zone.d/"$zone".zone + fi | + sudo install -m 440 -o root -g nsd /dev/stdin \ + /etc/nsd3/zone.d/"$zone".zone + cat <<-EOF + zone: + name: $zone + zonefile: /etc/nsd3/zone.d/$zone.zone + $(cat "$tool"/etc/nsd3/zone.d/"$zone".conf) + EOF + done +} | +sudo install -m 640 -o root -g nsd /dev/stdin \ + /etc/nsd3/nsd.conf + +"$tool"/local/runit-sv-start "$sv" +sudo nsdc rebuild +sudo nsdc reload +#sudo nsdc notify