Add a kuldge so named can work out of the box on Debian
authorRoy Marples <roy@marples.name>
Thu, 4 Nov 2010 15:46:21 +0000 (15:46 +0000)
committerRoy Marples <roy@marples.name>
Thu, 4 Nov 2010 15:46:21 +0000 (15:46 +0000)
as the init script there is called bind9.

Makefile
configure
named.in

index 75835dac8f49984e04ab04ed665598f16ac8eaf5..de5026487265d670e994d3ad8b0ad40d6be6ac07 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@ SED_PREFIX=           -e 's:@PREFIX@:${PREFIX}:g'
 SED_SYSCONFDIR=                -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
 SED_LIBEXECDIR=                -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
 SED_VARDIR=            -e 's:@VARDIR@:${VARDIR}:g'
+SED_RCDIR=             -e 's:@RCDIR@:${RCDIR}:g'
 SED_RESTARTCMD=                -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g'
 
 .SUFFIXES: .in
@@ -29,7 +30,7 @@ all: ${TARGET}
 
 .in:
        ${SED}  ${SED_PREFIX} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
-               ${SED_VARDIR} ${SED_RESTARTCMD} \
+               ${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} \
                $< > $@
 
 clean:
index 8dcb508f85f59137bffae2e1ae02cd24b4eec17b..7676e40f0df1bf3211bda51a2e1e619027e8e5ee 100755 (executable)
--- a/configure
+++ b/configure
@@ -7,6 +7,7 @@ BUILD=
 HOST=
 TARGET=
 RESTARTCMD=
+RCDIR=
 
 for x; do
        opt=${x%%=*}
@@ -119,6 +120,7 @@ done
 
 if [ -e /etc/arch-release -a -d /etc/rc.d ]; then
        echo "Overriding service status check for Arch Linux"
+       RCDIR=/etc/rc.d
        RESTARTCMD="[ -e /var/run/daemons/\1 ] \&\& /etc/rc.d/\1 restart"
        echo "yes"
 fi
@@ -135,6 +137,7 @@ fi
 if [ -z "$RESTARTCMD" ]; then
        printf "Checking for invoke-rc.d ... "
        if [ -x /usr/sbin/invoke-rc.d ]; then
+               RCDIR=/etc/init.d
                RESTARTCMD="/usr/sbin/invoke-rc.d --quiet \1 status >/dev/null 2>\&1 \&\& /usr/sbin/invoke-rc.d \1 restart"
                echo "yes"
        else
@@ -144,6 +147,7 @@ fi
 if [ -z "$RESTARTCMD" ]; then
        printf "Checking for service ... "
        if [ -x /sbin/service ]; then
+               RCDIR=/etc/init.d
                RESTARTCMD="/sbin/service \1 \&\& /sbin/service \1 restart"
                echo "yes"
        else
@@ -154,6 +158,7 @@ if [ -z "$RESTARTCMD" ]; then
        for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do
                printf "Checking for $x ... "
                if [ -d $x ]; then
+                       RCDIR=$x
                        RESTARTCMD="$x/\1 status >/dev/null 2>\&1 \&\& $x/\1 restart"
                        echo "yes"
                        break
@@ -168,8 +173,9 @@ if [ -z "$RESTARTCMD" ]; then
        exit 1
 fi
 
+echo "RCDIR=           $RCDIR" >>$CONFIG_MK
 # Work around bug in the dash shell as "echo 'foo \1'" does bad things
-printf "%s\n" "RESTARTCMD=     ${RESTARTCMD}" >>$CONFIG_MK
+printf "%s\n" "RESTARTCMD=     $RESTARTCMD" >>$CONFIG_MK
 
 echo
 echo "   SYSCONFDIR =          $SYSCONFDIR"
index dc414600a694828362a347443638739061bdc7c7..47231667d4578b3fe9471bffdffc545f8ba467cd 100644 (file)
--- a/named.in
+++ b/named.in
 [ -z "$named_zones" -a -z "$named_options" ] && exit 0
 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
 
+# Platform specific kludges
+if [ -z "$named_service" -a -z "$named_restart" -a \
+       -x "@RCDIR@" -a ! -x "@RCDIR@"/named ]
+then
+       if [ -x "@RCDIR@"/bind9 ]; then
+               # Debian and derivatives
+               named_service=bind9
+       fi
+fi
 : ${named_service:=named}
 : ${named_restart:=@RESTARTCMD ${named_service}@}
 newoptions="# Generated by resolvconf\n"