Remove surperfluous {}
authorRoy Marples <roy@marples.name>
Tue, 21 Apr 2009 12:34:14 +0000 (12:34 +0000)
committerRoy Marples <roy@marples.name>
Tue, 21 Apr 2009 12:34:14 +0000 (12:34 +0000)
Makefile
dnsmasq.in
libc.in
named.in
pdns_recursor.in [moved from pdns-recursor.in with 100% similarity]
resolvconf.in

index 0457cee505cec31b5922dccda4352ff12abb7fe7..c38186dfbec3048b4b562bc2f6e19ff5dc3fa7b6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ VARDIR?=      ${VARBASE}/run/resolvconf
 MANDIR?=       ${MANPREFIX}/man
 
 RESOLVCONF=    resolvconf resolvconf.8 resolvconf.conf.5
-SUBSCRIBERS=   libc dnsmasq named pdns-recursor
+SUBSCRIBERS=   libc dnsmasq named pdns_recursor
 TARGET=                ${RESOLVCONF} ${SUBSCRIBERS}
 
 .SUFFIXES: .in
index 93349f4f09bcdf3c6568e8c6243fe1651f5a3fff..cd646f0b19db3ab38b9476d48c970308efa7fdaa 100644 (file)
 
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
-[ -z "${dnsmasq_conf}" -o -z "${dnsmasq_resolv}" ] && exit 0
-eval "$(${RESOLVCONF:-resolvconf} -v)"
+[ -z "$dnsmasq_conf" -o -z "$dnsmasq_resolv" ] && exit 0
+: ${RESOLVCONF:=resolvconf}
+eval "$("$RESOLVCONF" -v)"
 
-PREFIX=@PREFIX@
 dnsmasqpid="${dnsmasq_pid:-/var/run/dnsmasq.pid}"
-
 newconf="# Generated by resolvconf\n"
-newresolv="${newconf}"
+newresolv="$newconf"
 
 # Using dbus means that we never have to restart the daemon
 # This is important as it means we should not drop DNS queries
@@ -45,77 +44,74 @@ newresolv="${newconf}"
 
 dbus=false
 dbuspid="${dbus_pid:-/var/run/dbus/dbus.pid}"
-[ -s "${dbuspid}" ] || dbuspid=/var/run/dbus.pid
-[ -s "${dbuspid}" ] || dbuspid=/var/run/dbus/pid
-if [ -s "${dbuspid}" -a -s ${dnsmasqpid} ]; then
+[ -s "$dbuspid" ] || dbuspid=/var/run/dbus.pid
+[ -s "$dbuspid" ] || dbuspid=/var/run/dbus/pid
+if [ -s "$dbuspid" -a -s "$dnsmasqpid" ]; then
        if dnsmasq --version 2>/dev/null | \
                grep -q "^Compile time options.*[[:space:]]DBus[[:space:]]"
        then
                # Sanity - check that dnsmasq and dbus are running
-               if kill -0 $(cat "${dbuspid}") 2>/dev/null && \
-                       kill -0 $(cat ${dnsmasqpid}) 2>/dev/null
+               if kill -0 $(cat "$dbuspid") 2>/dev/null && \
+                       kill -0 $(cat "$dnsmasqpid") 2>/dev/null
                then
                        dbus=true
-                       newconf="${newconf}\n# Domain specific servers will"
-                       newconf="${newconf} be sent over dbus\nenable-dbus\n"
+                       newconf="$newconf\n# Domain specific servers will"
+                       newconf="$newconf be sent over dbus\nenable-dbus\n"
                fi
        fi
 fi
 
-for n in ${NAMESERVERS}; do
-       case "\n${newresolv}\n" in
-       *"\nnameserver ${n}\n");;
-       *) newresolv="${newresolv}nameserver ${n}\n";;
-       esac
+for n in $NAMESERVERS; do
+       newresolv="${newresolv}nameserver $n\n"
 done
 
 dbusdest=
-for d in ${DOMAINS}; do
+for d in $DOMAINS; do
        dn="${d%%:*}"
        ns="${d#*:}"
-       while [ -n "${ns}" ]; do
-               if ${dbus}; then
+       while [ -n "$ns" ]; do
+               if $dbus; then
                        SIFS=${IFS-y} OIFS=$IFS
                        IFS=.
                        set -- ${ns%%,*}
                        num="0x$(printf "%02x" $1 $2 $3 $4)"
-                       if [ "${SIFS}" = "y" ]; then
+                       if [ "$SIFS" = yi ]; then
                                unset IFS
                        else
                                IFS=$OIFS
                        fi
-                       dbusdest="${dbusdest} uint32:$(printf "%u" ${num})"
-                       dbusdest="${dbusdest} string:${dn}"
+                       dbusdest="$dbusdest uint32:$(printf "%u" $num)"
+                       dbusdest="$dbusdest string:$dn"
                else
-                       newconf="${newconf}server=/${db}/${ns%%,*}\n"
+                       newconf="${newconf}server=/$dn/${ns%%,*}\n"
                fi
-               [ "${ns}" = "${ns#*,}" ] && break
+               [ "$ns" = "${ns#*,}" ] && break
                ns="${ns#*,}"
        done
 done
 
 changed=false
-if [ ! -f "${dnsmasq_conf}" ] || \
-       [ "$(cat "${dnsmasq_conf}")" != "$(printf "${newconf}")" ]
+if [ ! -f "$dnsmasq_conf" ] || \
+       [ "$(cat "$dnsmasq_conf")" != "$(printf "$newconf")" ]
 then
        changed=true
-       printf "${newconf}" > "${dnsmasq_conf}"
+       printf "$newconf" >"$dnsmasq_conf"
 fi
-if [ -f "${dnsmasq_resolv}" ]; then
-       if [ "$(cat "${dnsmasq_resolv}")" != "$(printf "${newresolv}")" ]; then
+if [ -f "$dnsmasq_resolv" ]; then
+       if [ "$(cat "$dnsmasq_resolv")" != "$(printf "$newresolv")" ]; then
                changed=true
-               printf "${newresolv}" > "${dnsmasq_resolv}"
+               printf "$newresolv" >"$dnsmasq_resolv"
        fi
 else
        # dnsmasq polls this file so no need to set changed=true
-       printf "${newresolv}" > "${dnsmasq_resolv}"
+       printf "$newresolv" >"$dnsmasq_resolv"
 fi
 
-${changed} && resolvconf -s dnsmasq restart
-if ${dbus}; then
-       ${restart} || kill -HUP $(cat ${dnsmasqpid})
+$changed && $RESOLVCONF -s dnsmasq restart
+if $dbus; then
+       $restart || kill -HUP $(cat "$dnsmasqpid")
        # Send even if empty so old servers are cleared
        dbus-send --system --dest=uk.org.thekelleys.dnsmasq \
                /uk/org/thekelleys/dnsmasq uk.org.thekelleys.SetServers \
-               ${dbusdest}
+               $dbusdest
 fi
diff --git a/libc.in b/libc.in
index e11a70e26728bc8f7f1ed4954a27826a5b39a458..43a16a3d769a0fa01a2de39be40f5e44e76bb914 100644 (file)
--- a/libc.in
+++ b/libc.in
@@ -26,7 +26,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-RESOLVCONF="${RESOLVCONF:-resolvconf}"
+: ${RESOLVCONF:=resolvconf}
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
@@ -40,52 +40,52 @@ key_get_value()
        shift
        if [ $# -eq 0 ]; then
                while read line; do
-                       case "${line}" in
-                       "${key}"*) echo "${line##${key}}";;
+                       case "$line" in
+                       "$key"*) echo "${line##$key}";;
                        esac
                done
        else
                for x; do
                        while read line; do
-                               case "${line}" in
-                               "${key}"*) echo "${line##${key}}";;
+                               case "$line" in
+                               "$key"*) echo "${line##$key}";;
                                esac
-                       done < "${x}"
+                       done < "$x"
                done
        fi
 }
 
 # Support original resolvconf configuration layout
 # as well as the openresolv config file
-if [ -f "${SYSCONFDIR}"/resolvconf.conf ]; then
-       . "${SYSCONFDIR}"/resolvconf.conf
-elif [ -d "${SYSCONFDIR}/resolvconf" ]; then
-       SYSCONFDIR="${SYSCONFDIR}/resolvconf/resolv.conf.d"
-       base="${SYSCONFDIR}/resolv.conf.d/base"
-       if [ -f "${BASE}" ]; then
-               name_servers="$(key_get_value "nameserver " "${base}")"
-               search_domains="$(key_get_value "search " "${base}")"
-               if [ -z "${search_domains}" ]; then
-                       search_domains="$(key_get_value "domain " "${base}")"
+if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then
+       . "$SYSCONFDIR"/resolvconf.conf
+elif [ -d "$SYSCONFDIR"/resolvconf ]; then
+       SYSCONFDIR="$SYSCONFDIR/resolvconf/resolv.conf.d"
+       base="$SYSCONFDIR/resolv.conf.d/base"
+       if [ -f "$base" ]; then
+               name_servers="$(key_get_value "nameserver " "$base")"
+               search_domains="$(key_get_value "search " "$base")"
+               if [ -z "$search_domains" ]; then
+                       search_domains="$(key_get_value "domain " "$base")"
                fi
-               resolv_conf_options="$(key_get_value "options " "${base}")"
+               resolv_conf_options="$(key_get_value "options " "$base")"
        fi
-       if [ -f "${SYSCONFDIR}"/resolv.conf.d/head ]; then
+       if [ -f "$SYSCONFDIR"/resolv.conf.d/head ]; then
                resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.d/head)"
        fi
-       if [ -f "${SYSCONFDIR}"/resolv.conf.d/tail ]; then
-               resolv_conf_tail="$(cat "${SYSCONFDIR}"/resolv.conf.d/tail)"
+       if [ -f "$SYSCONFDIR"/resolv.conf.d/tail ]; then
+               resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.d/tail)"
        fi
 fi
-resolv_conf="${resolv_conf:-/etc/resolv.conf}"
+: ${resolv_conf:=/etc/resolv.conf}
 
 uniqify()
 {
        local result=
        while [ -n "$1" ]; do
-               case " ${result} " in
+               case " $result " in
                *" $1 "*);;
-               *) result="${result} $1";;
+               *) result="$result $1";;
                esac
                shift
        done
@@ -95,62 +95,62 @@ uniqify()
 case "${resolv_conf_passthrough:-NO}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        newest=
-       for conf in "${IFACEDIR}"/*; do
-               if [ -z "${newest}" -o "${conf}" -nt "${newest}" ]; then
-                       newest="${conf}"
+       for conf in "$IFACEDIR"/*; do
+               if [ -z "$newest" -o "$conf" -nt "$newest" ]; then
+                       newest="$conf"
                fi
        done
-       [ -z "${newest}" ] && exit 0
-       newconf="$(cat "${newest}")\n"
+       [ -z "$newest" ] && exit 0
+       newconf="$(cat "$newest")\n"
        ;;
 *)
-       eval "$(${RESOLVCONF} -v)"
-       newsearch="$(uniqify ${search_domains} ${SEARCH})"
-       newns="$(uniqify ${name_servers} ${NAMESERVERS})"
+       eval "$($RESOLVCONF -v)"
+       newsearch="$(uniqify $search_domains $SEARCH)"
+       newns="$(uniqify $name_servers $NAMESERVERS)"
 
        # Hold our new resolv.conf in a variable to save on temporary files
        newconf="# Generated by resolvconf\n"
-       if [ -n "${resolv_conf_head}" ]; then
-               newconf="${newconf}${resolv_conf_head}\n"
+       if [ -n "$resolv_conf_head" ]; then
+               newconf="$newconf$resolv_conf_head\n"
        fi
-       [ -n "${newsearch}" ] && newconf="${newconf}search ${newsearch}\n"
-       for n in ${newns}; do
-               newconf="${newconf}nameserver ${n}\n"
+       [ -n "$newsearch" ] && newconf="${newconf}search $newsearch\n"
+       for n in $newns; do
+               newconf="${newconf}nameserver $n\n"
        done
 
        # Now get any configured options
-       opts="${resolv_conf_options}${resolv_conf_options:+ }"
-       opts="${opts}$(${RESOLVCONF} -l | key_get_value "options ")"
-       if [ -n "${opts}" ]; then
+       opts="$resolv_conf_options${resolv_conf_options:+ }"
+       opts="$opts$($RESOLVCONF -l | key_get_value "options ")"
+       if [ -n "$opts" ]; then
                newconf="${newconf}options"
-               for opt in $(uniqify ${opts}); do
-                       newconf="${newconf} ${opt}"
+               for opt in $(uniqify $opts); do
+                       newconf="${newconf} $opt"
                done
-               newconf="${newconf}\n"
+               newconf="$newconf\n"
        fi
 
-       if [ -n "{resolv_conf_tail}" ]; then
-               newconf="${newconf}${resolv_conf_tail}\n"
+       if [ -n "resolv_conf_tail" ]; then
+               newconf="$newconf$resolv_conf_tail\n"
        fi
        ;;
 esac
 
 # Check if the file has actually changed or not
-if [ -e "${resolv_conf}" ]; then
-       [ "$(cat "${resolv_conf}")" = "$(printf "${newconf}")" ] && exit 0
+if [ -e "$resolv_conf" ]; then
+       [ "$(cat "$resolv_conf")" = "$(printf "$newconf")" ] && exit 0
 fi
 
 # Create our resolv.conf now
-(umask 022; printf "${newconf}" > "${resolv_conf}")
+(umask 022; printf "$newconf" >"$resolv_conf")
 
-${RESOLVCONF} -s nscd restart
+$RESOLVCONF -s nscd restart
 retval=$?
 
 # Notify users of the resolver
-for script in "${LIBEXECDIR}"/libc.d/*; do
-       if [ -f "${script}" -a -x "${script}" ]; then
-               RESOLVCONF="${RESOLVCONF}" "${script}" "$@"
-               retval=$((${retval} + $?))
+for script in "$LIBEXECDIR"/libc.d/*; do
+       if [ -f "$script" -a -x "$script" ]; then
+               RESOLVCONF="$RESOLVCONF" "$script" "$@"
+               retval=$(($retval + $?))
        fi
 done
-exit ${retval}
+exit $retval
index 04db23b30bc6d07398ff35568f2e3b571c6b709d..17e30ab70a8c6598092ffc52b8b481e7be720440 100644 (file)
--- a/named.in
+++ b/named.in
 
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
-[ -z "${named_zones}" -o -z "${named_options}" ] && exit 0
-eval "$("${RESOLVCONF:-resolvconf}" -v)"
+[ -z "$named_zones" -o -z "$named_options" ] && exit 0
+: ${RESOLVCONF:=resolvconf}
+eval "$("$RESOLVCONF" -v)"
 
 newoptions="# Generated by resolvconf\n"
-newzones="${newoptions}"
+newzones="$newoptions"
 forward=
-for n in ${NAMESERVERS}; do
-       case "${forward}" in
-       *"\n\t${n};"*);;
-       *) forward="${forward}\n\t${n};";;
+for n in $NAMESERVERS; do
+       case "$forward" in
+       *"\n\t$n;"*);;
+       *) forward="$forward\n\t$n;";;
        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
 
-for d in ${DOMAINS}; do
+for d in $DOMAINS; do
        newzones="${newzones}zone \"${d%%:*}\" {\n"
-       newzones="${newzones}\ttype forward;\n"
-       newzones="${newzones}\tforward first;\n\tforwarders {\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
+       while [ -n "$ns" ]; do
+               newzones="$newzones\t\t${ns%%,*};\n"
+               [ "$ns" = "${ns#*,}" ] && break
                ns="${ns#*,}"
        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
 changed=false
-if [ ! -f "${named_options}" ] || \
-       [ "$(cat "${named_options}")" != "$(printf "${newoptions}")" ]
+if [ ! -f "$named_options" ] || \
+       [ "$(cat "$named_options")" != "$(printf "$newoptions")" ]
 then
-       printf "${newoptions}" > "${named_options}"
+       printf "$newoptions" > "$named_options"
        changed=true
 fi
-if [ ! -f "${named_zones}" ] || \
-       [ "$(cat "${named_zones}")" != "$(printf "${newzones}")" ]
+if [ ! -f "$named_zones" ] || \
+       [ "$(cat "$named_zones")" != "$(printf "$newzones")" ]
 then
-       printf "${newzones}" > "${named_zones}"
+       printf "$newzones" >"$named_zones"
        changed=true
 fi
 
-${changed} && resolvconf -s named restart
+$changed && $RESOLVCONF -s named restart
 exit 0
similarity index 100%
rename from pdns-recursor.in
rename to pdns_recursor.in
index 7b28cb807ff4197b6c6caefbb2febf6379c730a9..7e23b0cb01401426ae468210bc986ad877dafbe5 100644 (file)
@@ -28,22 +28,22 @@ ARGV0="$0"
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
-IFACEDIR="${VARDIR}/interfaces"
-METRICDIR="${VARDIR}/metrics"
-PRIVATEDIR="${VARDIR}/private"
+IFACEDIR="$VARDIR/interfaces"
+METRICDIR="$VARDIR/metrics"
+PRIVATEDIR="$VARDIR/private"
 
 # Support original resolvconf configuration layout
 # as well as the openresolv config file
-if [ -f "${SYSCONFDIR}"/resolvconf.conf ]; then
-       . "${SYSCONFDIR}"/resolvconf.conf
-elif [ -d "${SYSCONFDIR}/resolvconf" ]; then
-       SYSCONFDIR="${SYSCONFDIR}/resolvconf"
-       if [ -f "${SYSCONFDIR}"/interface-order ]; then
+if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then
+       . "$SYSCONFDIR"/resolvconf.conf
+elif [ -d "$SYSCONFDIR/resolvconf" ]; then
+       SYSCONFDIR="$SYSCONFDIR/resolvconf"
+       if [ -f "$SYSCONFDIR"/interface-order ]; then
                interface_order="$(cat "${SYSCONFDIR}"/interface-order)"
        fi
 fi
-dynamic_order="${dynamic_order:-tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]*}"
-interface_order="${interface_order:-lo lo[0-9]*}"
+: ${dynamic_order:=tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]*}
+: ${interface_order:=lo lo[0-9]*}
 
 error_exit()
 {
@@ -84,14 +84,14 @@ usage()
 echo_resolv()
 {
        local line=
-       [ -n "$1" -a -e "${IFACEDIR}/$1" ] || return 1
+       [ -n "$1" -a -e "$IFACEDIR/$1" ] || return 1
        echo "# resolv.conf from $1"
        # Our variable maker works of the fact each resolv.conf per interface
        # is separated by blank lines.
        # So we remove them when echoing them.
        while read line; do
-               [ -n "${line}" ] && echo "${line}"
-       done < "${IFACEDIR}/$1"
+               [ -n "$line" ] && echo "$line"
+       done < "$IFACEDIR/$1"
        echo
 }
 
@@ -107,17 +107,17 @@ parse_resolv()
        echo "NAMESERVERS="
 
        while read line; do
-               case "${line}" in
+               case "$line" in
                "# resolv.conf from "*)
                        if ${new}; then
                                iface="${line#\# resolv.conf from *}"
                                new=false
-                               case " ${private_interfaces} " in
-                               *" ${iface} "*)
+                               case " $private_interfaces " in
+                               *" $iface "*)
                                        private=true
                                        ;;
                                *)
-                                       if [ -e "${PRIVATEDIR}/${iface}" ]; then
+                                       if [ -e "$PRIVATEDIR/$iface" ]; then
                                                private=true
                                        else
                                                private=false
@@ -130,27 +130,27 @@ parse_resolv()
                        case "${line#* }" in
                        127.*|0.0.0.0|255.255.255.255) continue;;
                        esac
-                       ns="${ns}${line#* } "
+                       ns="$ns${line#* } "
                        ;;
                "domain "*|"search "*)
                        search="${line#* }"
                        ;;
                *)
-                       [ -n "${line}" ] && continue
-                       if [ -n "${ns}" -a -n "${search}" ]; then
+                       [ -n "$line" ] && continue
+                       if [ -n "$ns" -a -n "$search" ]; then
                                newns=
-                               for n in ${ns}; do
-                                       newns="${newns}${newns:+,}${n}"
+                               for n in $ns; do
+                                       newns="$newns${newns:+,}$n"
                                done
                                ds=
-                               for d in ${search}; do
-                                       ds="${ds}${ds:+ }${d}:${newns}"
+                               for d in $search; do
+                                       ds="$ds${ds:+ }$d:$newns"
                                done
-                               echo "DOMAINS=\"\${DOMAINS} ${ds}\""
+                               echo "DOMAINS=\"\$DOMAINS $ds\""
                        fi
-                       echo "SEARCH=\"\${SEARCH} ${search}\""
-                       if ! ${private}; then
-                               echo "NAMESERVERS=\"\${NAMESERVERS} ${ns}\""
+                       echo "SEARCH=\"\$SEARCH $search\""
+                       if ! $private; then
+                               echo "NAMESERVERS=\"\$NAMESERVERS $ns\""
                        fi
                        ns=
                        search=
@@ -164,9 +164,9 @@ uniqify()
 {
        local result=
        while [ -n "$1" ]; do
-               case " ${result} " in
+               case " $result " in
                *" $1 "*);;
-               *) result="${result} $1";;
+               *) result="$result $1";;
                esac
                shift
        done
@@ -175,37 +175,37 @@ uniqify()
 
 force=false
 while getopts a:d:fhilm:ps:uv OPT; do
-       case "${OPT}" in
+       case "$OPT" in
        f) force=true;;
        h) usage;;
-       m) IF_METRIC="${OPTARG}";;
+       m) IF_METRIC="$OPTARG";;
        p) IF_PRIVATE=1;;
-       s) cmd=s; service="${OPTARG}";;
+       s) cmd=s; service="$OPTARG";;
        '?') ;;
-       *) cmd="${OPT}"; iface="${OPTARG}";;
+       *) cmd="$OPT"; iface="$OPTARG";;
        esac
 done
-shift $((${OPTIND} - 1))
-args="${iface}${iface:+ }$@"
+shift $(($OPTIND - 1))
+args="$iface${iface:+ }$@"
 
 # We do our service restarting here so that our subscribers don't have to know
 # about the OS's init system.
-if [ "${cmd}" = "s" ]; then
+if [ "$cmd" = "s" ]; then
        if [ -n "$1" ]; then
                action="$1"
                shift
        fi
-       [ -z "${action}" ] && usage "Action not specified"
+       [ -z "$action" ] && usage "Action not specified"
 
        # If restarting check if service is running or not if we can
-       if [ "${action}" = "restart" ]; then
-               if [ -s /var/run/"${service}".pid ]; then
-                       kill -0 $(cat /var/run/"${service}".pid) 2>/dev/null
-               elif [ -s /var/run/"${service}"/"${service}".pid ]; then
-                       kill -0 $(cat /var/run/"${service}"/"${service}".pid) \
+       if [ "$action" = restart ]; then
+               if [ -s /var/run/"$service".pid ]; then
+                       kill -0 $(cat /var/run/"$service".pid) 2>/dev/null
+               elif [ -s /var/run/"$service"/"$service".pid ]; then
+                       kill -0 $(cat /var/run/"$service"/"$service".pid) \
                                2>/dev/null
-               elif [ -s /var/run/"${service}"/pid ]; then
-                       kill -0 $(cat /var/run/"${service}"/pid) 2>/dev/null
+               elif [ -s /var/run/"$service"/pid ]; then
+                       kill -0 $(cat /var/run/"$service"/pid) 2>/dev/null
                else
                        false
                fi
@@ -213,21 +213,21 @@ if [ "${cmd}" = "s" ]; then
                [ $? != 0 ] && exit 0
        fi      
        if [ -x /sbin/service ]; then
-               service "${service}" "${action}" "$@" 
-       elif [ -x /etc/init.d/"${service}" -a -x /sbin/runscript ]; then
-               if [ "${action}" = "restart" ]; then
-                       /etc/init.d/"${service}" --quiet --nodeps \
+               service "$service" "$action" "$@" 
+       elif [ -x /etc/init.d/"$service" -a -x /sbin/runscript ]; then
+               if [ "$action" = "restart" ]; then
+                       /etc/init.d/"$service" --quiet --nodeps \
                                conditionalrestart "$@"
                else
-                       /etc/init.d/"${service}" --quiet --nodeps \
-                               "${action}" "$@"
+                       /etc/init.d/"$service" --quiet --nodeps \
+                               "$action" "$@"
                fi
-       elif [ -x /etc/init.d/"${service}" ]; then
-               /etc/init.d/"${service}" "${action}" "$@"
+       elif [ -x /etc/init.d/"$service" ]; then
+               /etc/init.d/"$service" "$action" "$@"
        elif [ -x /etc/rc.d/"${service}" ]; then
-               /etc/rc.d/"${service}" "${action}" "$@" 
-       elif [ -x /etc/rc.d/rc."${service}" ]; then
-               /etc/rc.d/rc."${service}" "${action}" "$@"
+               /etc/rc.d/"$service" "$action" "$@" 
+       elif [ -x /etc/rc.d/rc."$service" ]; then
+               /etc/rc.d/rc."$service" "$action" "$@"
        else
                error_exit "Don't know how to interact with services on" \
                        "this platform"
@@ -236,191 +236,190 @@ if [ "${cmd}" = "s" ]; then
 fi
 
 # -l lists our resolv files, optionally for a specific interface
-if [ "${cmd}" = "l" -o "${cmd}" = "i" ]; then
-       [ -d "${IFACEDIR}" ] || exit 0
+if [ "$cmd" = l -o "$cmd" = i ]; then
+       [ -d "$IFACEDIR" ] || exit 0
 
        report=false
        # If we have an interface ordering list, then use that.
        # It works by just using pathname expansion in the interface directory.
-       if [ -n "${args}" ]; then
-               list="${args}"
-               ${force} || report=true
+       if [ -n "$args" ]; then
+               list="$args"
+               $force || report=true
        else
-               cd "${IFACEDIR}"
-               for i in ${interface_order}; do
-                       [ -e "${i}" ] && list="${list} ${i}"
+               cd "$IFACEDIR"
+               for i in $interface_order; do
+                       [ -e "$i" ] && list="$list $i"
                done
-               for i in ${dynamic_order}; do
-                       if [ -e "${i}" -a ! -e "${METRICDIR}/"*" ${i}" ]; then
-                               list="${list} ${i}"
+               for i in $dynamic_order; do
+                       if [ -e "$i" -a ! -e "$METRICDIR/"*" $i" ]; then
+                               list="$list $i"
                        fi
                done
-               if [ -d "${METRICDIR}" ]; then
-                       cd "${METRICDIR}"
+               if [ -d "$METRICDIR" ]; then
+                       cd "$METRICDIR"
                        for i in *; do
-                               list="${list} ${i#* }"
+                               list="$list ${i#* }"
                        done
                fi
-               list="${list} *"
+               list="$list *"
        fi
 
        retval=0
-       cd "${IFACEDIR}"
-       for i in $(uniqify ${list}); do
+       cd "$IFACEDIR"
+       for i in $(uniqify $list); do
                # Only list interfaces which we really have
-               if ! [ -e "${i}" ]; then
-                       if ${report}; then
-                               echo "No resolv.conf for interface ${i}" >&2
-                               retval=$((${retval} + 1))
+               if ! [ -e "$i" ]; then
+                       if $report; then
+                               echo "No resolv.conf for interface $i" >&2
+                               retval=$(($retval + 1))
                        fi
                        continue
                fi
                
-               if [ "${cmd}" = "i" ]; then
-                       printf "${i} "
+               if [ "$cmd" = i ]; then
+                       printf "$i "
                else
-                       echo_resolv "${i}"
+                       echo_resolv "$i"
                fi
        done
-       [ "${cmd}" = "i" ] && echo
-       exit ${retval} 
+       [ "$cmd" = i ] && echo
+       exit $retval 
 fi
 
-if [ "${cmd}" = "v" ]; then
-       eval "$("${ARGV0}" -l "${iface}" | parse_resolv)"
+if [ "$cmd" = v ]; then
+       eval "$("$ARGV0" -l "$iface" | parse_resolv)"
 
        # Ensure that we only list each domain once
        newdomains=
-       for d in ${DOMAINS}; do
+       for d in $DOMAINS; do
                dn="${d%%:*}"
-               case " ${newdomains}" in
+               case " $newdomains" in
                *" ${dn}:"*) continue;;
                esac
-               newdomains="${newdomains}${newdomains:+ }${dn}:"
+               newdomains="$newdomains${newdomains:+ }$dn:"
                newns=
-               for nd in ${DOMAINS}; do
-                       if [ "${dn}" = "${nd%%:*}" ]; then
+               for nd in $DOMAINS; do
+                       if [ "$dn" = "${nd%%:*}" ]; then
                                ns="${nd#*:}"
-                               while [ -n "${ns}" ]; do
-                                       case ",${newns}," in
+                               while [ -n "$ns" ]; do
+                                       case ",$newns," in
                                        *,${ns%%,*},*) ;;
-                                       *) newns="${newns}${newns:+,}${ns%%,*}"
-                                               ;;
+                                       *) newns="$newns${newns:+,}${ns%%,*}";;
                                        esac
-                                       [ "${ns}" = "${ns#*,}" ] && break
+                                       [ "$ns" = "${ns#*,}" ] && break
                                        ns="${ns#*,}"
                                done
                        fi
                done
-               newdomains="${newdomains}${newns}"
+               newdomains="$newdomains$newns"
        done
-       echo "DOMAINS='${newdomains}'"
-       echo "SEARCH='$(uniqify ${SEARCH})'"
-       echo "NAMESERVERS='$(uniqify ${NAMESERVERS})'"
+       echo "DOMAINS='$newdomains'"
+       echo "SEARCH='$(uniqify $SEARCH)'"
+       echo "NAMESERVERS='$(uniqify $NAMESERVERS)'"
        exit 0
 fi
 
 # Test that we have valid options
-if [ "${cmd}" = "a" -o "${cmd}" = "d" ]; then
-       if [ -z "${iface}" ]; then
+if [ "$cmd" = a -o "$cmd" = d ]; then
+       if [ -z "$iface" ]; then
                usage "Interface not specified"
        fi
-elif [ "${cmd}" != "u" ]; then
-       [ -n "${cmd}" -a "${cmd}" != "h" ] && usage "Unknown option ${cmd}"
+elif [ "$cmd" != u ]; then
+       [ -n "$cmd" -a "$cmd" != h ] && usage "Unknown option $cmd"
        usage
 fi
-if [ "${cmd}" = "a" ]; then
+if [ "$cmd" = a ]; then
        for x in '/' \\ ' ' '*'; do
-               case "${iface}" in
-               *[${x}]*) error_exit "${x} not allowed in interface name";;
+               case "$iface" in
+               *[$x]*) error_exit "$x not allowed in interface name";;
                esac
        done
        for x in '.' '-' '~'; do
-               case "${iface}" in
-               [${x}]*) error_exit \
-                       "${x} not allowed at start of interface name";;
+               case "$iface" in
+               [$x]*) error_exit \
+                       "$x not allowed at start of interface name";;
                esac
        done
-       [ "${cmd}" = "a" -a -t 0 ] && error_exit "No file given via stdin"
+       [ "$cmd" = a -a -t 0 ] && error_exit "No file given via stdin"
 fi
 
-if [ ! -d "${IFACEDIR}" ]; then
-       if [ ! -d "${VARDIR}" ]; then
-               if [ -L "${VARDIR}" ]; then
-                       dir="$(readlink "${VARDIR}")"
+if [ ! -d "$IFACEDIR" ]; then
+       if [ ! -d "$VARDIR" ]; then
+               if [ -L "$VARDIR" ]; then
+                       dir="$(readlink "$VARDIR")"
                        # link maybe relative
                        cd "${VARDIR%/*}"
-                       if ! mkdir -m 0755 -p "${dir}"; then
+                       if ! mkdir -m 0755 -p "$dir"; then
                                error_exit "Failed to create needed" \
-                                       "directory ${dir}"
+                                       "directory $dir"
                        fi
                else
-                       if ! mkdir -m 0755 -p "${VARDIR}"; then
+                       if ! mkdir -m 0755 -p "$VARDIR"; then
                                error_exit "Failed to create needed" \
-                                       "directory ${VARDIR}"
+                                       "directory $VARDIR"
                        fi
                fi
        fi
-       mkdir -m 0755 -p "${IFACEDIR}" || \
-               error_exit "Failed to create needed directory ${IFACEDIR}"
+       mkdir -m 0755 -p "$IFACEDIR" || \
+               error_exit "Failed to create needed directory $IFACEDIR"
 else
        # Delete any existing information about the interface
-       if [ "${cmd}" = "d" ]; then
-               cd "${IFACEDIR}"
-               for i in ${args}; do
-                       if [ "${cmd}" = "d" -a ! -e "${i}" ]; then
-                               ${force} && continue
+       if [ "$cmd" = d ]; then
+               cd "$IFACEDIR"
+               for i in $args; do
+                       if [ "$cmd" = d -a ! -e "$i" ]; then
+                               $force && continue
                                error_exit "No resolv.conf for" \
-                                       "interface ${i}"
+                                       "interface $i"
                        fi
-                       rm -f "${i}" "${METRICDIR}/"*" ${i}" \
-                               "${PRIVATEDIR}/${i}" || exit $?
+                       rm -f "$i" "$METRICDIR/"*" $i" \
+                               "$PRIVATEDIR/$i" || exit $?
                done
        fi
 fi
 
-if [ "${cmd}" = "a" ]; then
+if [ "$cmd" = a ]; then
        # Read resolv.conf from stdin
        resolv="$(cat)\n"
        # If what we are given matches what we have, then do nothing
-       if [ -e "${IFACEDIR}/${iface}" ]; then
-               if [ "$(printf "${resolv}")" = \
-                       "$(cat "${IFACEDIR}/${iface}")" ]
+       if [ -e "$IFACEDIR/$iface" ]; then
+               if [ "$(printf "$resolv")" = \
+                       "$(cat "$IFACEDIR/$iface")" ]
                then
                        exit 0
                fi
-               rm "${IFACEDIR}/${iface}"
+               rm "$IFACEDIR/$iface"
        fi
-       printf "${resolv}" >"${IFACEDIR}/${iface}" || exit $?
-       [ ! -d "${METRICDIR}" ] && mkdir "${METRICDIR}"
-       rm -f "${METRICDIR}/"*" ${iface}"
-       if [ -n "${IF_METRIC}" ]; then
+       printf "$resolv" >"$IFACEDIR/$iface" || exit $?
+       [ ! -d "$METRICDIR" ] && mkdir "$METRICDIR"
+       rm -f "$METRICDIR/"*" $iface"
+       if [ -n "$IF_METRIC" ]; then
                # Pad metric to 6 characters, so 5 is less than 10
                while [ ${#IF_METRIC} -le 6 ]; do
-                       IF_METRIC="0${IF_METRIC}"
+                       IF_METRIC="0$IF_METRIC"
                done
-               echo " " >"${METRICDIR}/${IF_METRIC} ${iface}"
+               echo " " >"$METRICDIR/$IF_METRIC $iface"
        fi
-       case "${IF_PRIVATE}" in
+       case "$IF_PRIVATE" in
        [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
-               if [ ! -d "${PRIVATEDIR}" ]; then
-                       [ -e "${PRIVATEDIR}" ] && rm "${PRIVATEDIR}"
-                       mkdir "${PRIVATEDIR}"
+               if [ ! -d "$PRIVATEDIR" ]; then
+                       [ -e "$PRIVATEDIR" ] && rm "$PRIVATEDIR"
+                       mkdir "$PRIVATEDIR"
                fi
-               [ -d "${PRIVATEDIR}" ] && echo " " >"${PRIVATEDIR}/${iface}"
+               [ -d "$PRIVATEDIR" ] && echo " " >"$PRIVATEDIR/$iface"
                ;;
        *)
-               if [ -e "${PRIVATEDIR}/${iface}" ]; then
-                       rm -f "${PRIVATEDIR}/${iface}"
+               if [ -e "$PRIVATEDIR/$iface" ]; then
+                       rm -f "$PRIVATEDIR/$iface"
                fi
                ;;
        esac
 fi
 
 retval=0
-for script in "${LIBEXECDIR}"/*; do
-       [ -f "${script}" -a -x "${script}" ] || continue
-       RESOLVCONF="${ARGV0}" "${script}" "${cmd}" "${iface}"
-       retval=$((${retval} + $?))
+for script in "$LIBEXECDIR"/*; do
+       [ -f "$script" -a -x "$script" ] || continue
+       RESOLVCONF="$ARGV0" "$script" "$cmd" "$iface"
+       retval=$(($retval + $?))
 done
-exit ${retval}
+exit $retval