Package:  batmand
Version:  0.2-1
Severity: serious
Tags:     patch
User:     initscripts-ng-de...@lists.alioth.debian.org
Usertags: incorrect-dependency incorrect-runlevels
User:     debian...@lists.debian.org
Usertags: piuparts

With dependency based boot sequencing, I discovered what I believe is
a bug in the init.d scripts of this package.  The package uses files
in /usr/ but do not depend on $remote_fs.  The runlevel settings when
using legacu boot ordering do not match the init.d script header.  The
package fail to install if the netbase is not installed, yet the
netbase package is not a package dependency.  To avoid this it is
better to depend on $network.  Last, the script used to start after
syslog in runels 2-5, but do not depend on $syslog.  The installation
problem was discovered by piuparts, see <URL:
http://piuparts.debian.org/sid/fail/batmand_0.3.2-2.log > for the test
log.  These are the error messages:

  update-rc.d: warning: batmand start runlevel arguments (2 3 4 5) do
    not match LSB Default-Start values (S)
  update-rc.d: warning: batmand stop runlevel arguments (0 1 6) do not
    match LSB Default-Stop values (0 6)
  insserv: Service networking has to be enabled to start service batmand
  insserv: Service ifupdown has to be enabled to start service batmand
  insserv: exiting now!

<URL: 
http://refspecs.freestandards.org/LSB_2.1.0/LSB-generic/LSB-generic/initscrcomconv.html
 >
documents the LSB header format.  Some debian notes are available from
<URL: http://wiki.debian.org/LSBInitScripts >.

This patch should solve the issue.  Without it, the package fail to
install when netbase isn't installed, and will start a bit too early
during boot.  As the stop action in the init.d scrtip is just to kill
the daemon, the stop links in runlevels 0 and 6 can be dropped as
sendsigs will kill the daemon more efficiently.  The postinst fragment
is to detect installations with the old runlevels, and remove the
symlinks to let debhelper insert the correct runlevels, and the rules
change is to make sure legacy ordering uses the same runlevels as the
dependency based boot ordering.

diff -N -ur ../batmand-0.3.2/debian/batmand.init 
../batmand-0.3.2-pere/debian/batmand.init
--- ../batmand-0.3.2/debian/batmand.init        2009-09-25 13:16:19.000000000 
+0200
+++ ../batmand-0.3.2-pere/debian/batmand.init   2009-09-25 13:22:09.000000000 
+0200
@@ -1,10 +1,10 @@
 #! /bin/sh
 ### BEGIN INIT INFO
 # Provides:          batmand
-# Required-Start:    networking ifupdown $local_fs
-# Required-Stop:     $local_fs
-# Default-Start:     S
-# Default-Stop:      0 6
+# Required-Start:    $network $remote_fs $syslog
+# Required-Stop:     $network $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      1
 # Short-Description: /etc/init.d/batmand: start batmand
 ### END INIT INFO

diff -N -ur ../batmand-0.3.2/debian/batmand.postinst 
../batmand-0.3.2-pere/debian/batmand.postinst
--- ../batmand-0.3.2/debian/batmand.postinst    1970-01-01 01:00:00.000000000 
+0100
+++ ../batmand-0.3.2-pere/debian/batmand.postinst       2009-09-25 
13:26:22.000000000 +0200
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+# Recover from incorrect init.d script headers in version 0.3.2-2 and earlier
+if [ "$1" = "configure" ] && dpkg --compare-versions "$2" le "0.3.2-2" \
+   && [ -f /etc/rcS.d/S[0-9][0-9]batmand ] \
+   && ! [ -f /etc/rc2.d/S[0-9][0-9]batmand ] ; then
+    update-rc.d -f batmand remove
+fi
+
+#DEBHELPER#
diff -N -ur ../batmand-0.3.2/debian/rules ../batmand-0.3.2-pere/debian/rules
--- ../batmand-0.3.2/debian/rules       2009-09-25 13:16:19.000000000 +0200
+++ ../batmand-0.3.2-pere/debian/rules  2009-09-25 13:29:00.000000000 +0200
@@ -146,7 +146,7 @@
        dh_installdocs -s
        dh_installexamples -s
 #      dh_install -s
-       dh_installinit -s
+       dh_installinit -s -u"start 20 2 3 4 5 . stop 20 1 ."
        dh_installman -s
        dh_link -s
        dh_strip -s --dbg-package=batmand-dbg

Happy hacking,
--
Petter Reinholdtsen



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to