We should use lower case for normal variables.
[openresolv] / named.in
index 6e9cfa0d0d5294629ee319900c9318136fc584d6..c7b8806b3249c61c82d4eba97a223277244220b4 100644 (file)
--- a/named.in
+++ b/named.in
 [ -z "${named_zones}" -o -z "${named_options}" ] && exit 0
 eval "$("${RESOLVCONF:-resolvconf}" -v)"
 
 [ -z "${named_zones}" -o -z "${named_options}" ] && exit 0
 eval "$("${RESOLVCONF:-resolvconf}" -v)"
 
-NEWOPTIONS="# Generated by resolvconf\n"
-NEWZONES="${NEWOPTIONS}"
-FORWARD=
-for N in ${NAMESERVERS}; do
-       case "${FORWARD}" in
-       *"\n\t${N};"*);;
-       *) FORWARD="${FORWARD}\n\t${N};";;
+newoptions="# Generated by resolvconf\n"
+newzones="${newoptions}"
+forward=
+for n in ${NAMESERVERS}; do
+       case "${forward}" in
+       *"\n\t${n};"*);;
+       *) forward="${forward}\n\t${n};";;
        esac
 done
        esac
 done
-if [ -n "${FORWARD}" ]; then
-       NEWOPTIONS="${NEWOPTIONS}forward first;\nforwarders {${FORWARD}\n};\n"
+if [ -n "${forward}" ]; then
+       newoptions="${newoptions}forward first;\nforwarders {${forward}\n};\n"
 fi
 
 fi
 
-for D in ${DOMAINS}; do
-       NEWZONES="${NEWZONES}zone \"${D%%:*}\" {\n"
-       NEWZONES="${NEWZONES}\ttype forward;\n"
-       NEWZONES="${NEWZONES}\tforward first;\n\tforwarders {\n"
-       NS="${D#*:}"
-       while [ -n "${NS}" ]; do
-               NEWZONES="${NEWZONES}\t\t${NS%%,*};\n"
-               [ "${NS}" = "${NS#*,}" ] && break
-               NS="${NS#*,}"
+for d in ${DOMAINS}; do
+       newzones="${newzones}zone \"${d%%:*}\" {\n"
+       newzones="${newzones}\ttype forward;\n"
+       newzones="${newzones}\tforward first;\n\tforwarders {\n"
+       ns="${d#*:}"
+       while [ -n "${ns}" ]; do
+               newzones="${newzones}\t\t${ns%%,*};\n"
+               [ "${ns}" = "${ns#*,}" ] && break
+               ns="${ns#*,}"
        done
        done
-       NEWZONES="${NEWZONES}\t};\n};\n"
+       newzones="${newzones}\t};\n};\n"
 done
 
 # No point in changing files or reloading bind if the end result has not
 # changed
 done
 
 # No point in changing files or reloading bind if the end result has not
 # changed
-RELOAD="no"
+changed=false
 if [ -f "${named_options}" ]; then 
 if [ -f "${named_options}" ]; then 
-       if [ "$(cat "${named_options}")" != "$(printf "${NEWOPTIONS}")" ]; then
-               printf "${NEWOPTIONS}" > "${named_options}"
-               RELOAD="yes"
+       if [ "$(cat "${named_options}")" != "$(printf "${newoptions}")" ]; then
+               printf "${newoptions}" > "${named_options}"
+               changed=true
        fi
 else
        fi
 else
-       printf "${NEWOPTIONS}" > "${named_options}"
-       RELOAD="yes"
+       printf "${newoptions}" > "${named_options}"
+       changed=true
 fi
 if [ -f "${named_zones}" ]; then
 fi
 if [ -f "${named_zones}" ]; then
-       if [ "$(cat "${named_zones}")" != "$(printf "${NEWZONES}")" ]; then
-               printf "${NEWZONES}" > "${named_zones}"
-               RELOAD="yes"
+       if [ "$(cat "${named_zones}")" != "$(printf "${newzones}")" ]; then
+               printf "${newzones}" > "${named_zones}"
+               changed=true
        fi
 else
        fi
 else
-       printf "${NEWZONES}" > "${named_zones}"
-       RELOAD="yes"
+       printf "${newzones}" > "${named_zones}"
+       changed=true
 fi
 
 fi
 
-[ "${RELOAD}" = "yes" ] && resolvconf -s named restart
+${changed} && resolvconf -s named restart
 exit 0
 exit 0