Package: init-system-helpers
Version: 1.34
Severity: normal

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

The sys-v compatibility helpers (service, {invoke,update}-rc.d,
debhelpers, et al.) currently only consider .service units, ignoring
compound .target units, when doing things such as overriding LSB
scripts, enabling/starting services, etc.

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.

An example patch for /usr/sbin/service 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 let me know whether this approach is
acceptable in which case I will extend it to all of the necessary
support scripts?


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


Many thanks,

Terry
--- a/service	2015-04-06 16:50:43.000000000 +0100
+++ b/service	2016-06-01 11:49:16.201754015 +0100
@@ -183,7 +183,12 @@
 # systemctl calls.
 if [ -n "$is_systemd" ]
 then
-   UNIT="${SERVICE%.sh}.service"
+   # If there is an umbrella target for the service then use it
+   if [ "$(systemctl -p ConsistsOf show ${SERVICE%.sh}.target)" != "ConsistsOf=" ]; then
+      UNIT="${SERVICE%.sh}.target"
+   else
+      UNIT="${SERVICE%.sh}.service"
+   fi
    case "${ACTION}" in
       restart|status)
          exec systemctl ${ACTION} ${UNIT}
_______________________________________________
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