[Pkg-sysvinit-devel] Bug#768450: Patch
Didier Roche
didrocks at ubuntu.com
Fri Nov 7 13:59:13 UTC 2014
Please find a debdiff to address the above issue, following what's done
for upstart.
I'm opened to any suggestion to make it better :)
-------------- next part --------------
diff -Nru sysvinit-2.88dsf/debian/changelog sysvinit-2.88dsf/debian/changelog
--- sysvinit-2.88dsf/debian/changelog 2014-10-26 18:36:53.000000000 +0100
+++ sysvinit-2.88dsf/debian/changelog 2014-11-07 14:53:17.000000000 +0100
@@ -1,3 +1,16 @@
+sysvinit (2.88dsf-58) UNRELEASED; urgency=low
+
+ * invoke-rc.d: don't start disabled systemd services when there is no
+ init script. If we only had an upstart (or none) and systemd job,
+ the job is started unconditionally on invoke-rc.d [restart|start].
+ Use a similar logic than for upstart: (Closes: #768450)
+ - invoke-rc.d start <unit> don't do anything on systemd if the service is
+ disabled.
+ - invoke-rc.d restart <unit> only restart a disabled service if the daemon
+ was already running (forced by the admin).
+
+ -- Didier Roche <didrocks at ubuntu.com> Fri, 07 Nov 2014 14:34:14 +0100
+
sysvinit (2.88dsf-57) unstable; urgency=low
* Upload to unstable.
diff -Nru sysvinit-2.88dsf/debian/src/sysv-rc/sbin/invoke-rc.d sysvinit-2.88dsf/debian/src/sysv-rc/sbin/invoke-rc.d
--- sysvinit-2.88dsf/debian/src/sysv-rc/sbin/invoke-rc.d 2014-10-25 23:23:53.000000000 +0200
+++ sysvinit-2.88dsf/debian/src/sysv-rc/sbin/invoke-rc.d 2014-11-07 14:56:35.000000000 +0100
@@ -520,7 +520,32 @@
systemctl daemon-reload
fi
case $saction in
- start|stop|restart|status)
+ start|restart)
+ RUNNING=
+ DISABLED=
+ UNIT_STATUS=`systemctl status "${UNIT}" 2>/dev/null`
+ if echo "${UNIT_STATUS}" | grep -q 'running'; then
+ RUNNING=1
+ fi
+ if echo "${UNIT_STATUS}" | grep -q 'disabled'; then
+ DISABLED=1
+ fi
+
+ if [ -n "$DISABLED" ] && [ "$saction" = "start" ]; then
+ exit 0
+ fi
+ # If the job is disabled and is not currently
+ # running, the job is not restarted. However, if
+ # the job is disabled but has been forced into
+ # the running state, we *do* stop and restart it
+ # since this is expected behaviour
+ # for the admin who forced the start.
+ if [ -n "$DISABLED" ] && [ -z "$RUNNING" ] && [ "$saction" = "restart" ]; then
+ exit 0
+ fi
+ systemctl "${saction}" "${UNIT}" && exit 0
+ ;;
+ stop|status)
systemctl "${saction}" "${UNIT}" && exit 0
;;
reload)
More information about the Pkg-sysvinit-devel
mailing list