Simpifly logic and fix a typo. openresolv-3.1.1
authorRoy Marples <roy@marples.name>
Thu, 19 Mar 2009 07:38:04 +0000 (07:38 +0000)
committerRoy Marples <roy@marples.name>
Thu, 19 Mar 2009 07:38:04 +0000 (07:38 +0000)
dnsmasq.in
named.in

index 21450f30886b2a0d59b35b3d88aab0ed7ee8e76b..93349f4f09bcdf3c6568e8c6243fe1651f5a3fff 100644 (file)
@@ -95,12 +95,9 @@ for d in ${DOMAINS}; do
 done
 
 changed=false
-if [ -f "${dnsmasq_conf}" ]; then
-       if [ "$(cat "${dnsmasq_conf}")" != "$(printf "${newconf}")" ]; then
-               changes=true
-               printf "${newconf}" > "${dnsmasq_conf}"
-       fi
-else
+if [ ! -f "${dnsmasq_conf}" ] || \
+       [ "$(cat "${dnsmasq_conf}")" != "$(printf "${newconf}")" ]
+then
        changed=true
        printf "${newconf}" > "${dnsmasq_conf}"
 fi
index c7b8806b3249c61c82d4eba97a223277244220b4..04db23b30bc6d07398ff35568f2e3b571c6b709d 100644 (file)
--- a/named.in
+++ b/named.in
@@ -60,21 +60,15 @@ done
 # No point in changing files or reloading bind if the end result has not
 # changed
 changed=false
-if [ -f "${named_options}" ]; then 
-       if [ "$(cat "${named_options}")" != "$(printf "${newoptions}")" ]; then
-               printf "${newoptions}" > "${named_options}"
-               changed=true
-       fi
-else
+if [ ! -f "${named_options}" ] || \
+       [ "$(cat "${named_options}")" != "$(printf "${newoptions}")" ]
+then
        printf "${newoptions}" > "${named_options}"
        changed=true
 fi
-if [ -f "${named_zones}" ]; then
-       if [ "$(cat "${named_zones}")" != "$(printf "${newzones}")" ]; then
-               printf "${newzones}" > "${named_zones}"
-               changed=true
-       fi
-else
+if [ ! -f "${named_zones}" ] || \
+       [ "$(cat "${named_zones}")" != "$(printf "${newzones}")" ]
+then
        printf "${newzones}" > "${named_zones}"
        changed=true
 fi