UpstartCompatibleInitScripts

Revision 2 as of 2013-05-19 00:47:30

Clear message

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 is_init_upstart; then
            exit 1
        fi
        [...]
        ;;
    stop)
        if is_init_upstart; then
            exit 0
        fi
        [...]
        ;;
    restart|force-reload)
        if is_init_upstart; then
            exit 1
        fi
        [...]
        ;;
esac

*