@@ -1,69 +1,128 @@
---- pdns/pdns.in.orig 2013-01-07 11:29:06.301972809 +0100
-+++ pdns/pdns.in 2013-01-07 12:00:16.217749159 +0100
-@@ -2,17 +2,16 @@
+diff -ru pdns-3.2/pdns/pdns.in pdns-3.2.fresh/pdns/pdns.in
+--- pdns/pdns.in.orig 2013-05-22 08:23:55.921220023 +0200
++++ pdns/pdns.in 2013-05-22 08:23:36.721292790 +0200
+@@ -2,20 +2,33 @@
# chkconfig: - 80 75
# description: PDNS is a versatile high performance authoritative nameserver
--### BEGIN INIT INFO
--# Provides: pdns
--# Required-Start: $remote_fs $network $syslog
--# Required-Stop: $remote_fs $network $syslog
--# Should-Start: $all
--# Should-Stop:
--# Default-Start: 2 3 4 5
--# Default-Stop: 0 1 6
--# Short-Description: Start/stop PowerDNS authoritative server
--# Description: Start/stop PowerDNS authoritative server
--### END INIT INFO
-+#
-+# powerdns This shell script takes care of starting and stopping powerdns.
-+#
-+# chkconfig: 345 80 75
-+# description: PowerDNS is a versatile high performance \
-+# authoritative nameserver
-+# probe: true
-+# processname: powerdns
-+# pidfile: /var/run/powerdns/powerdns.pid
-+# config: /etc/powerdns/pdns.conf
-
- set -e
-
-@@ -28,11 +27,13 @@
-
- cd $SOCKETPATH
- suffix=$(basename $0 | cut -d- -f2- -s)
--if [ -n "$suffix" ]
-+if [ $suffix ]
+-prefix=/usr
+-exec_prefix=/usr
+-BINARYPATH=/usr/bin
+-SBINARYPATH=/usr/sbin
+-SOCKETPATH=/var/run
+-
++### BEGIN INIT INFO
++# Provides: pdns
++# Required-Start: $remote_fs $network $syslog
++# Required-Stop: $remote_fs $network $syslog
++# Should-Start: $all
++# Should-Stop:
++# Default-Start: 2 3 4 5
++# Default-Stop: 0 1 6
++# Short-Description: Start/stop PowerDNS authoritative server
++# Description: Start/stop PowerDNS authoritative server
++### END INIT INFO
++
++set -e
++
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++BINARYPATH=@bindir@
++SBINARYPATH=@sbindir@
++SOCKETPATH=@socketdir@
+
+ [ -f "$SBINARYPATH/pdns_server" ] || exit 0
+
+-cd $SOCKETPATH
+-suffix=`basename $0 | awk -F- '{print $2}'`
+-
++[ -r /etc/default/pdns ] && . /etc/default/pdns
+
+-if [ $suffix ]
++cd $SOCKETPATH
++suffix=$(basename $0 | cut -d- -f2- -s)
++if [ -n "$suffix" ]
then
-+ [ -f /etc/pdns/$suffix/pdns.conf ] || exit 0
EXTRAOPTS=--config-name=$suffix
PROGNAME=pdns-$suffix
- else
-+ [ -f /etc/pdns/pdns.conf ] || exit 0
- PROGNAME=pdns
- fi
+@@ -30,9 +43,8 @@
+ ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)
+ }
+
+-
+-doPC ping
+-NOTRUNNING=$?
++NOTRUNNING=0
++doPC ping || NOTRUNNING=$?
+
+ case "$1" in
+ status)
+@@ -42,6 +54,7 @@
+ echo $ret
+ else
+ echo "not running"
++ exit 3
+ fi
+ ;;
-@@ -63,6 +64,7 @@
+@@ -50,7 +63,6 @@
if test "$NOTRUNNING" = "0"
then
doPC quit
-+ rm -f /var/lock/subsys/pdns
+- rm -f /var/lock/subsys/pdns
echo $ret
else
echo "not running"
-@@ -73,6 +75,7 @@
+@@ -61,7 +73,6 @@
force-stop)
echo -n "Stopping PowerDNS authoritative nameserver: "
killall -v -9 pdns_server
-+ rm -f /var/lock/subsys/pdns
+- rm -f /var/lock/subsys/pdns
echo "killed"
;;
-@@ -84,6 +87,7 @@
+@@ -71,21 +82,28 @@
+ then
+ echo "already running"
else
- if $pdns_server --daemon --guardian=yes
+- $pdns_server --daemon --guardian=yes
+- if test "$?" = "0"
++ if $pdns_server --daemon --guardian=yes
then
-+ touch /var/lock/subsys/pdns
+- touch /var/lock/subsys/pdns
echo "started"
- else
- echo "starting failed"
++ else
++ echo "starting failed"
++ exit 1
+ fi
+ fi
+ ;;
+
+ force-reload | restart)
+ echo -n "Restarting PowerDNS authoritative nameserver: "
+- echo -n stopping and waiting..
+- doPC quit
+- sleep 3
+- echo done
++ if test "$NOTRUNNING" = "1"
++ then
++ echo "not running, starting"
++ else
++
++ echo -n stopping and waiting..
++ doPC quit
++ sleep 3
++ echo done
++ fi
+ $0 start
+ ;;
+
+@@ -176,7 +194,7 @@
+
+
+ *)
+- echo pdns [start\|stop\|force-reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
++ echo pdns [start\|stop\|force-reload\|reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
+
+ ;;
+ esac
|