Am 31.05.2016 um 12:16 schrieb Chris Wilson:
> Jessie's 40-systemd script automatically invokes "systemctl daemon-reload" but
> only when run from a dpkg install. Even this backwards-compatibility measure
> seems to have been removed in unstable.

This is correct. Nowadays invoke-rc.d calls daemon-reload, so doing it
twice is a bit excessive.

> Please consider invoking "systemctl -p LoadState show $service" from 
> 40-systemd,
> and if it says "not-found" then run "systemctl daemon-reload" to generate a
> service file for it.

I think in a case like yours, where the package manager is not involved,
doing an implicit reload for not-found in the lsb hook makes sense.
After all, we are pretty sure the sysv init script actually exists. So
the missing generated service file is indeed a pretty good indicator for
a missing daemon-reload.

So something like the attached patch?

Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
diff --git a/debian/extra/init-functions.d/40-systemd b/debian/extra/init-functions.d/40-systemd
index f80d5bc..6b15668 100644
--- a/debian/extra/init-functions.d/40-systemd
+++ b/debian/extra/init-functions.d/40-systemd
@@ -13,6 +13,10 @@ if [ -d /run/systemd/system ]; then
     state=$(systemctl -p LoadState show $service 2>/dev/null)
     [ "$state" = "LoadState=masked" ] && exit 0
 
+    # If the state is not-found, this might be a newly installed SysV init
+    # script where systemd-sysv-generator has not been run yet.
+    [ "$state" = "LoadState=not-found" ] && systemctl daemon-reload
+
     # Redirect SysV init scripts when executed by the user
     if [ $PPID -ne 1 ] && [ -z "${init:-}" ] && [ -z "${_SYSTEMCTL_SKIP_REDIRECT:-}" ]; then
         case $(readlink -f "$0") in

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to