UpstartCompatibleInitScripts

Differences between revisions 2 and 3
Revision 2 as of 2013-05-19 00:47:30
Size: 1878
Editor: vorlon
Comment: formatting
Revision 3 as of 2013-05-19 00:49:55
Size: 2012
Editor: vorlon
Comment: lsb-base
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
        if is_init_upstart; then         if init_is_upstart; then
Line 19: Line 19:
        if is_init_upstart; then         if init_is_upstart; then
Line 25: Line 25:
        if is_init_upstart; then         if init_is_upstart; then
Line 32: Line 32:
*  * Manually add a versioned dependency on lsb-base for the use of init_is_upstart:
{{{
Depends: [...], lsb-base (>= 4.1+Debian3)
}}}

Beginning in saucy, the upstart job support in debhelper and sysvinit has been synchronized with current Debian policy. This enables patches for upstart jobs to be safely forwarded to Debian for the first time, following a few simple steps.

These instructions all assume the package is using debhelper (and in particular, dh_installinit) for maintainer script handling of jobs/init scripts. If a package is not using dh_installinit, or if it is calling dh_installinit with the --noscripts option, particular care must be taken to properly handle upgrades from packages using the older style of upstart job support in Ubuntu. This page does not attempt to document the required steps if you are not using dh_installinit; if you have questions, consult the dh_installinit source, or just convert the package to use debhelper.

Step-by-step howto

  • Make sure that the upstart jobs and init scripts in the package have matching names. If the names do not match, either the init script should be split (cf. /etc/init.d/samba->/etc/init.d{s,n}mbd in the samba package), or dummy upstart jobs should be created (cf. /etc/init/mountall.sh.conf in the mountall package) so that the names line up. Without this, insserv will not correctly detect that the upstart job has started and dependency-based booting will fail.

  • Edit the init scripts to call init_is_upstart and exit without taking any action if running on an upstart system. E.g.:

. /lib/lsb/init-functions

case $1 in
    start)
        if init_is_upstart; then
            exit 1
        fi
        [...]
        ;;
    stop)
        if init_is_upstart; then
            exit 0
        fi
        [...]
        ;;
    restart|force-reload)
        if init_is_upstart; then
            exit 1
        fi
        [...]
        ;;
esac
  • Manually add a versioned dependency on lsb-base for the use of init_is_upstart:

Depends: [...], lsb-base (>= 4.1+Debian3)

UpstartCompatibleInitScripts (last edited 2013-05-30 22:54:20 by vorlon)