Package: anacron Version: 2.3-18 Severity: wishlist Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu quantal ubuntu-patch
Hi Peter, With the policy proposal for upstart in Debian gradually solidifying in bug #591791, I thought it might be time to look at forwarding some upstart jobs from Ubuntu into Debian while doing package merges for the quantal release. Anacron happened to be first on my list, so here goes. :) The attached patch adds an upstart job for anacron, which will be used in preference over the init script when upstart is installed. Explanatory changelog entry from the Ubuntu package: * Add native upstart support. * Don't bother with starting anacron on install, since it will be started soon from cron or at boot. There are several caveats here. - If building with debhelper (<< 9.20120410), including with debhelper 8.0.0 in squeeze, the package will end up with a hard dependency on upstart. That's probably not what you want; but I'm not sure if it's worth adding a versioned build-dependency here. That probably depends on whether you expect there to be backports of the package. - invoke-rc.d needs a patch yet to make it actually look at the upstart job instead of the init script (bug #671284). Since anacron is itself a short-lived service, it's probably not fatal in this case to have an unpatched invoke-rc.d; and the next upload of upstart to Debian will certainly add a dependency on the patched sysvinit-utils. So it's up to you if you'd like to wait and add an explicit dependency. - The init_is_upstart helper function is not yet implemented by the lsb-base package. This is even less impact than the previous issue; if the function is not available, the init script will assume upstart is not available and do the right thing anyway. So I don't think there's any reason to wait for lsb-base. Thanks for considering the patch. -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer http://www.debian.org/ slanga...@ubuntu.com vor...@debian.org
=== modified file 'debian/changelog' === modified file 'debian/init.d' --- debian/init.d 2012-03-29 21:09:47 +0000 +++ debian/init.d 2012-05-02 06:05:50 +0000 @@ -24,6 +24,9 @@ case "$1" in start) + if init_is_upstart 2>/dev/null; then + exit 1 + fi log_daemon_msg "Starting anac(h)ronistic cron" "anacron" if test x"$ANACRON_RUN_ON_BATTERY_POWER" != x"yes" && test -x /usr/bin/on_ac_power then @@ -46,6 +49,10 @@ : ;; stop) + if init_is_upstart 2>/dev/null && status anacron 2>/dev/null | grep -q start + then + exit 0 + fi log_daemon_msg "Stopping anac(h)ronistic cron" "anacron" start-stop-daemon --stop --exec /usr/sbin/anacron --oknodo --quiet log_end_msg 0 === modified file 'debian/rules' --- debian/rules 2012-03-29 21:09:47 +0000 +++ debian/rules 2012-05-01 05:12:25 +0000 @@ -17,4 +17,4 @@ dh_installcron --name=0anacron override_dh_installinit: - dh_installinit -u"start 89 2 3 4 5 ." + dh_installinit --no-start -u"start 89 2 3 4 5 ." === added file 'debian/upstart' --- debian/upstart 1970-01-01 00:00:00 +0000 +++ debian/upstart 2012-05-01 05:08:44 +0000 @@ -0,0 +1,14 @@ +# anacron - anac(h)ronistic cron +# +# anacron executes commands at specific periods, but does not assume that +# the machine is running continuously + +description "anac(h)ronistic cron" + +start on runlevel [2345] +stop on runlevel [!2345] + +expect fork +normal exit 0 + +exec anacron -s