X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=blobdiff_plain;f=etc%2Fsv%2Fnsd3%2Fconfigure.sh;h=43da55873abbbbb7809f77881240369f790b56cf;hp=0e870e36ba65bc55876d2c26a68621fb7f2d3696;hb=22f04b9fac14adc3d3fc98273ba126c3a51792c3;hpb=5ce6d51b9c15b2e316d60fad4ecfa1ea1b32bf7b;ds=sidebyside diff --git a/etc/sv/nsd3/configure.sh b/etc/sv/nsd3/configure.sh index 0e870e3..43da558 100644 --- a/etc/sv/nsd3/configure.sh +++ b/etc/sv/nsd3/configure.sh @@ -1,7 +1,6 @@ rule apt_get_install nsd rule insserv_remove nsd3 -sudo rm -rf \ - /etc/nsd3/zone.d + sudo install -d -m 750 -o root -g nsd \ /etc/nsd3/zone.d { @@ -11,30 +10,33 @@ sudo install -d -m 750 -o root -g nsd \ ip4-only: yes EOF cat "$tool"/etc/nsd3/nsd.conf - local conf - for conf in "$tool"/etc/nsd3/zone.d/*.conf - do conf=${conf#"$tool"/etc/nsd3/zone.d/} - local domain=${conf%.conf} - if test -e "$tool"/etc/nsd3/zone.d/"$domain".zone.m4 + 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=$domain \ - --define=ZONE_SERIAL=$(cd "$tool" && git log -1 --format="%ct" -- etc/nsd3/zone.d/"$domain".zone.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/"$domain".zone.m4 - else cat "$tool"/etc/nsd3/zone.d/"$domain".zone + "$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/"$domain".zone - sudo install -m 440 -o root -g nsd \ - "$tool"/etc/nsd3/zone.d/"$conf" \ - /etc/nsd3/zone.d/"$conf" + /etc/nsd3/zone.d/"$zone".zone cat <<-EOF zone: - name: $domain - zonefile: /etc/nsd3/zone.d/$domain.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 + +rule _runit_sv_start "$sv" sudo nsdc rebuild +sudo nsdc reload +#sudo nsdc notify