[Pkg-sysvinit-devel] Bug#768450: Correct second version of the patch

Didier Roche didrocks at ubuntu.com
Fri Nov 7 15:38:32 UTC 2014


Sorry, I sent the updated patch of #768456 (which is similar) to that 
package instead of the other one.

Please find attached the correct updated patch, with a more accurate 
changelog.
Any feedback welcome.
-------------- 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 16:32:34.000000000 +0100
@@ -1,3 +1,16 @@
+sysvinit (2.88dsf-58) UNRELEASED; urgency=medium
+
+  * invoke-rc.d: don't start disabled systemd services when invoke-rc.d
+    is directly invoked. The job is then started unconditionally on
+    invoke-rc.d [restart|start]. (Closes: #768450)
+    Use a similar logic than for upstart:
+    - 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 16:18:40.000000000 +0100
@@ -520,7 +520,27 @@
                     systemctl daemon-reload
                 fi
                 case $saction in
-                    start|stop|restart|status)
+                    start|restart)
+                        systemctl --quiet is-enabled "${UNIT}"
+                        ENABLED=$?
+                        systemctl --quiet is-active "${UNIT}"
+                        RUNNING=$?
+
+                        if [ $ENABLED != 0 ] && [ "$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 [ $ENABLED != 0 ] && [ $RUNNING != 0 ] && [ "$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