Only use OpenRC options if /sbin/runscript is present and check dnsmasq is running...
authorRoy Marples <roy@marples.name>
Sun, 11 Nov 2007 00:06:32 +0000 (00:06 +0000)
committerRoy Marples <roy@marples.name>
Sun, 11 Nov 2007 00:06:32 +0000 (00:06 +0000)
dnsmasq

diff --git a/dnsmasq b/dnsmasq
index e2fcecdfcbd70dfb31baceb37589f14dcef5456a..c99bad05a540f1279e88fffcdd78274d124d74ca 100755 (executable)
--- a/dnsmasq
+++ b/dnsmasq
@@ -149,10 +149,13 @@ else
        printf "${NEWRESOLV}" > "${DNSMASQRESOLV}"
 fi
 
+[ -x /sbin/runscript ] && INIT_EXTRA="--quiet --nodeps"
+
 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
+               /etc/init.d/dnsmasq ${INIT_EXTRA} conditionalrestart
+       elif [ -x "${PREFIX}"/etc/rc.d/dnsmasq -a -s /var/run/dnsmasq.pid ]; then
+               kill -0 $(cat /var/run/dnsmasq.pid) && \
                "${PREFIX}"/etc/rc.d/dnsmasq restart
        fi
 fi
@@ -160,7 +163,7 @@ fi
 if [ "${DBUS}" = "yes" ]; then
        if [ "${RELOAD}" != "yes" ]; then
                if [ -x "${PREFIX}"/etc/init.d/dnsmasq ]; then
-                       /etc/init.d/dnsmasq --quiet reload
+                       /etc/init.d/dnsmasq ${INIT_EXTRA} reload
                elif [ -x "${PREFIX}"/etc/rc.d/dnsmasq ]; then
                        "${PREFIX}"/etc/rc.d/dnsmasq reload
                fi