Package: debhelper
Version: 4.9.8
Severity: wishlist
Tags: patch
Problem:
--------
If a daemon, service or similar is updated dh_installinit will have it
automatically reinserted into the corresponding runlevels by calling
update-rc.d. After this the service itself will be restarted.
However by updating a service or daemon the user does not necessarily
wish that his current runlevel configuration be changed. A configuration
that had been done by the user should not be overwritten.
Proposed solution:
------------------
Only touch the runlevel configuration when (re-)installing the same
version of the package or when freshly installing (first or initial
installation).
Solution:
---------
The update of the runlevels happens in $package.postinst. There we find
a line like the following:
# Automatically added by dh_installinit
if [ -x "/etc/init.d/webmin" ]; then
update-rc.d webmin defaults >/dev/null
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d webmin start || exit 0
else
/etc/init.d/webmin start || exit 0
fi
fi
# End automatically added section
This code snipplet is being produced by dh_installinit from the code
template /usr/share/debhelper/autoscripts/postinst-init.
dh_installinit is using the library /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm
which sets $dh{VERSION}. Thus, the postinst script can be passed knowledge of
the version of its own package and, since at the time of installation the
install
procedure calls $package.postinst with the version of the previously installed
version, the postinst script can compare the two and only reconfigure runlevels
if there is no previously installed version or if the previous and the current
are the same.
The resulting postinst code template could look like the following:
if [ -x "/etc/init.d/#SCRIPT#" ]; then
VERSION_OF_NEW_PACKAGE="#VERSION#"
# only update runlevel and restart the script if reinstalling
# the package or freshly installing a package
if [ "VERSION_OF_NEW_PACKAGE" = "$2" -o -z "$2" ]; 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
fi
fi
The call inside dh_installinit which installs this codesnipplet would
need to be slightly expanded to include the new variable #VERSION#:
autoscript($package,"postinst", "postinst-init",
"s/#SCRIPT#/$script/;s/#INITPARMS#/$params/;".
"s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/;s/#VERSION#/$dh{VERSION}");
This refinement of behaveour would need to be documented in the manpages and
possibly
in the Debian policy document.
*t
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable'), (50, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.4.22
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages debhelper depends on:
hi binutils 2.16.1-2 The GNU assembler, linker and bina
hi coreutils [fileutils] 5.2.1-2.1 The GNU core utilities
ii debconf-utils 1.4.58 debconf utilities
ii dpkg-dev 1.13.11 package building tools for Debian
hi file 4.12-1 Determines file type using "magic"
hi fileutils 5.2.1-2.1 The GNU file management utilities
hi html2text 1.3.2a-2 An advanced HTML to text converter
ii perl 5.8.7-3 Larry Wall's Practical Extraction
hi po-debconf 0.9.0 manage translated Debconf template
debhelper recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]