Allow only one configuration file to be configured.
authorRoy Marples <roy@marples.name>
Fri, 4 Dec 2009 10:13:50 +0000 (10:13 +0000)
committerRoy Marples <roy@marples.name>
Fri, 4 Dec 2009 10:13:50 +0000 (10:13 +0000)
dnsmasq.in
named.in

index 16220a299500a6010b27cfae76670524d0e0bad7..3189d657adc9955188c3a5f8b74b7af5b1813e5e 100644 (file)
@@ -28,7 +28,7 @@
 
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
-[ -z "$dnsmasq_conf" -o -z "$dnsmasq_resolv" ] && exit 0
+[ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0
 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
 
 : ${dnsmasq_pid:=/var/run/dnsmasq.pid}
@@ -90,20 +90,25 @@ for d in $DOMAINS; do
 done
 
 changed=false
-if [ ! -f "$dnsmasq_conf" ] || \
-       [ "$(cat "$dnsmasq_conf")" != "$(printf "$newconf")" ]
-then
-       changed=true
-       printf "$newconf" >"$dnsmasq_conf"
-fi
-if [ -f "$dnsmasq_resolv" ]; then
-       if [ "$(cat "$dnsmasq_resolv")" != "$(printf "$newresolv")" ]; then
+if [ -n "$dnsmasq_conf" ]; then
+       if [ ! -f "$dnsmasq_conf" ] || \
+               [ "$(cat "$dnsmasq_conf")" != "$(printf "$newconf")" ]
+       then
                changed=true
+               printf "$newconf" >"$dnsmasq_conf"
+       fi
+fi
+if [ -n "$dnsmasq_resolv" ]; then
+       if [ -f "$dnsmasq_resolv" ]; then
+               if [ "$(cat "$dnsmasq_resolv")" != "$(printf "$newresolv")" ]
+               then
+                       changed=true
+                       printf "$newresolv" >"$dnsmasq_resolv"
+               fi
+       else
+               # dnsmasq polls this file so no need to set changed=true
                printf "$newresolv" >"$dnsmasq_resolv"
        fi
-else
-       # dnsmasq polls this file so no need to set changed=true
-       printf "$newresolv" >"$dnsmasq_resolv"
 fi
 
 if $changed; then
index da0dc68788f4dbae1b07226c89cc4b83aa45e65e..9d88910a7eed59080a999268cb03608983a07e71 100644 (file)
--- a/named.in
+++ b/named.in
@@ -28,7 +28,7 @@
 
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
-[ -z "$named_zones" -o -z "$named_options" ] && exit 0
+[ -z "$named_zones" -a -z "$named_options" ] && exit 0
 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
 
 : ${named_restart:=@RESTARTCMD named@}
@@ -62,17 +62,21 @@ done
 # No point in changing files or reloading bind if the end result has not
 # changed
 changed=false
-if [ ! -f "$named_options" ] || \
-       [ "$(cat "$named_options")" != "$(printf "$newoptions")" ]
-then
-       printf "$newoptions" >"$named_options"
-       changed=true
+if [ -n "$named_options" ]; then
+       if [ ! -f "$named_options" ] || \
+               [ "$(cat "$named_options")" != "$(printf "$newoptions")" ]
+       then
+               printf "$newoptions" >"$named_options"
+               changed=true
+       fi
 fi
-if [ ! -f "$named_zones" ] || \
-       [ "$(cat "$named_zones")" != "$(printf "$newzones")" ]
-then
-       printf "$newzones" >"$named_zones"
-       changed=true
+if [ -n "$named_zones" ]; then
+       if [ ! -f "$named_zones" ] || \
+               [ "$(cat "$named_zones")" != "$(printf "$newzones")" ]
+       then
+               printf "$newzones" >"$named_zones"
+               changed=true
+       fi
 fi
 
 if $changed; then