Package: systemd
Version: 230-2
Severity: normal

This message [1] identifies that compound target units are the
appropriate mechanism for controlling multiple service units.

The LSB override hook currently only consider .service units, ignoring
compound .target units.

Support for this would be useful for providing systemd scripts for
multi-daemon services such as ISC DHCP server (with IPv4 and IPv6;
discussions ongoing here [2]) and PostgreSQL.

A patch for /lib/lsb/init-functions.d/40-systemd is attached. We probe
for a compound .target unit (having component services in the derived
ConsistsOf property) of matching service name invoking this as we
would a plain .service unit.

Would a maintainer kindly review? It may be desirable to coordinate
this with corresponding patches to the init-system-helpers scripts
[3].


[1] https://lists.freedesktop.org/archives/systemd-devel/2015-July/033628.html
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=792894
[3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826011


Many thanks,

Terry
--- a/40-systemd	2016-06-01 11:55:20.885757279 +0100
+++ b/40-systemd	2016-06-01 12:00:21.421866664 +0100
@@ -19,7 +19,11 @@
                 # Some services can't reload through the .service file,
                 # but can through the init script.
                 prog=${0##*/}
-                service="${prog%.sh}.service"
+                if [ "$(systemctl -p ConsistsOf show ${prog%.sh}.target)" != "ConsistsOf=" ]; then
+                    service="${prog%.sh}.target"
+                else
+                    service="${prog%.sh}.service"
+                fi
                 if [ "$(systemctl -p CanReload show $service 2>/dev/null)" = "CanReload=no" ] && [ "${1:-}" = "reload" ]; then
                     _use_systemctl=0
                 fi
@@ -51,7 +55,12 @@
             ;;
     esac
 
-    service="${prog%.sh}.service"
+    # If there is an umbrella target for prog then use it
+    if [ "$(systemctl -p ConsistsOf show ${prog%.sh}.target)" != "ConsistsOf=" ]; then
+        service="${prog%.sh}.target"
+    else
+        service="${prog%.sh}.service"
+    fi
 
     # Don't try to run masked services. Don't check for errors, if
     # this errors, we'll just call systemctl and possibly explode

_______________________________________________
Pkg-systemd-maintainers mailing list
Pkg-systemd-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers

Reply via email to