Package: debhelper
Version: 7.9.3
Severity: minor

Policy 9.3.3.2 requires that all maintainer scripts use invoke-rc.d for
calling init scripts, and both sysv-rc and file-rc have shipped
implementations of invoke-rc.d since before the lenny release (and probably
much longer).  Still, the dh_installinit postinst snippet checks for the
existence of invoke-rc.d first with a fallback to direct execution of the
init script.  I think it's time that these snippets be simplified to call
invoke-rc.d directly:

 - if invoke-rc.d *is* missing, calling the init script fails to apply
   runlevel policy, which isn't what we want
 - calling the init script at all will increasingly be the wrong thing to do
   as alternate init systems become available as backends to invoke-rc.d
 - it's prettier

Attached is a patch for this change.  Note that the example given in Policy
still includes such a fallback; I'll want to patch Policy too for this, but
given that it's just an example, I think fixing debhelper is the higher
priority.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages debhelper depends on:
ii  binutils                      2.20.1-12  The GNU assembler, linker and bina
ii  dpkg-dev                      1.15.7.2   Debian package development tools
ii  file                          5.04-3     Determines file type using "magic"
ii  html2text                     1.3.2a-15  advanced HTML to text converter
ii  man-db                        2.5.7-3    on-line manual pager
ii  perl                          5.10.1-14  Larry Wall's Practical Extraction 
ii  perl-base                     5.10.1-14  minimal Perl system
ii  po-debconf                    1.0.16     tool for managing templates file t

debhelper recommends no packages.

Versions of packages debhelper suggests:
ii  dh-make                       0.55       tool that converts source archives

-- no debconf information
>From ce0d6e3ba57dea7577f9fcd29b335de4e1eecca0 Mon Sep 17 00:00:00 2001
From: Steve Langasek <steve.langa...@canonical.com>
Date: Mon, 17 Jan 2011 01:52:12 -0800
Subject: [PATCH] dh_installinit: never call init scripts directly, only through 
invoke-rc.d

---
 autoscripts/postinst-init         |    6 +-----
 autoscripts/postinst-init-restart |    6 +-----
 autoscripts/prerm-init            |    6 +-----
 autoscripts/prerm-init-norestart  |    6 +-----
 4 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/autoscripts/postinst-init b/autoscripts/postinst-init
index 6a1c572..2430b2c 100644
--- a/autoscripts/postinst-init
+++ b/autoscripts/postinst-init
@@ -1,8 +1,4 @@
 if [ -x "/etc/init.d/#SCRIPT#" ]; then
        update-rc.d #SCRIPT# #INITPARMS# >/dev/null
-       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
-               invoke-rc.d #SCRIPT# start || #ERROR_HANDLER#
-       else
-               /etc/init.d/#SCRIPT# start || #ERROR_HANDLER#
-       fi
+       invoke-rc.d #SCRIPT# start || #ERROR_HANDLER#
 fi
diff --git a/autoscripts/postinst-init-restart 
b/autoscripts/postinst-init-restart
index ba4b3a0..35bba20 100644
--- a/autoscripts/postinst-init-restart
+++ b/autoscripts/postinst-init-restart
@@ -5,9 +5,5 @@ if [ -x "/etc/init.d/#SCRIPT#" ]; then
        else
                _dh_action=start
        fi
-       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
-               invoke-rc.d #SCRIPT# $_dh_action || #ERROR_HANDLER#
-       else
-               /etc/init.d/#SCRIPT# $_dh_action || #ERROR_HANDLER#
-       fi
+       invoke-rc.d #SCRIPT# $_dh_action || #ERROR_HANDLER#
 fi
diff --git a/autoscripts/prerm-init b/autoscripts/prerm-init
index 96d3755..2a8aa4c 100644
--- a/autoscripts/prerm-init
+++ b/autoscripts/prerm-init
@@ -1,7 +1,3 @@
 if [ -x "/etc/init.d/#SCRIPT#" ]; then
-       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
-               invoke-rc.d #SCRIPT# stop || #ERROR_HANDLER#
-       else
-               /etc/init.d/#SCRIPT# stop || #ERROR_HANDLER#
-       fi
+       invoke-rc.d #SCRIPT# stop || #ERROR_HANDLER#
 fi
diff --git a/autoscripts/prerm-init-norestart b/autoscripts/prerm-init-norestart
index 9b63174..cacde6e 100644
--- a/autoscripts/prerm-init-norestart
+++ b/autoscripts/prerm-init-norestart
@@ -1,7 +1,3 @@
 if [ -x "/etc/init.d/#SCRIPT#" ] && [ "$1" = remove ]; then
-       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
-               invoke-rc.d #SCRIPT# stop || #ERROR_HANDLER#
-       else
-               /etc/init.d/#SCRIPT# stop || #ERROR_HANDLER#
-       fi
+       invoke-rc.d #SCRIPT# stop || #ERROR_HANDLER#
 fi
-- 
1.7.1

Reply via email to