Use cat instead of grep for listing our resolvconfs
[openresolv] / dnsmasq
diff --git a/dnsmasq b/dnsmasq
index a0f852f430c04a07f0ea99060f6188a21e289f41..8b104eca02ab00679f0dafe5db65bf4c095e9611 100755 (executable)
--- a/dnsmasq
+++ b/dnsmasq
@@ -64,7 +64,7 @@ NEWRESOLV="${NEWCONF}"
 # so we need to validate a few things first.
 # Check for DBus support in the binary
 DBUS=no
 # so we need to validate a few things first.
 # Check for DBus support in the binary
 DBUS=no
-if [ -s "${PREFIX}"/var/run/dbus.pid -a "${PREFIX}"/var/run/dnsmasq.pid ]; then
+if [ -s "${PREFIX}"/var/run/dbus.pid -a -s "${PREFIX}"/var/run/dnsmasq.pid ]; then
        if dnsmasq --version 2>/dev/null | \
                grep -q "^Compile time options.*[[:space:]]DBus[[:space:]]" \
                ; then
        if dnsmasq --version 2>/dev/null | \
                grep -q "^Compile time options.*[[:space:]]DBus[[:space:]]" \
                ; then
@@ -149,22 +149,9 @@ else
        printf "${NEWRESOLV}" > "${DNSMASQRESOLV}"
 fi
 
        printf "${NEWRESOLV}" > "${DNSMASQRESOLV}"
 fi
 
-if [ "${RELOAD}" = "yes" ]; then
-       if [ -x "${PREFIX}"/etc/init.d/dnsmasq ]; then
-               /etc/init.d/dnsmasq --quiet --nodeps conditionalrestart
-       elif [ -x "${PREFIX}"/etc/rc.d/dnsmasq ]; then
-               "${PREFIX}"/etc/rc.d/dnsmasq restart
-       fi
-fi
-
+[ "${RELOAD}" = "yes" ] && resolvconf -s dnsmasq restart
 if [ "${DBUS}" = "yes" ]; then
 if [ "${DBUS}" = "yes" ]; then
-       if [ "${RELOAD}" != "yes" ]; then
-               if [ -x "${PREFIX}"/etc/init.d/dnsmasq ]; then
-                       /etc/init.d/dnsmasq --quiet reload
-               elif [ -x "${PREFIX}"/etc/rc.d/dnsmasq ]; then
-                       "${PREFIX}"/etc/rc.d/dnsmasq reload
-               fi
-       fi
+       [ "${RELOAD}" != "yes" ] && resolvconf -s dnsmasq reload
        # Send even if emtpy so old servers are cleared
        dbus-send --system --dest=uk.org.thekelleys.dnsmasq \
                /uk/org/thekelleys/dnsmasq uk.org.thekelleys.SetServers \
        # Send even if emtpy so old servers are cleared
        dbus-send --system --dest=uk.org.thekelleys.dnsmasq \
                /uk/org/thekelleys/dnsmasq uk.org.thekelleys.SetServers \