From d46cb14d80310c8081ec12e21df9445b5c1bc91d Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Fri, 3 Oct 2025 00:05:56 +0200 Subject: Functionally in sync with core/systemd 258-4. --- systemd-hook | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'systemd-hook') diff --git a/systemd-hook b/systemd-hook index d64341f..0a13f20 100644 --- a/systemd-hook +++ b/systemd-hook @@ -1,6 +1,6 @@ #!/bin/sh -e -is_chrooted() { +skip_chrooted() { if systemd-detect-virt --chroot; then echo >&2 " Skipped: Running in chroot." exit 0 @@ -8,15 +8,17 @@ is_chrooted() { } systemd_live() { - is_chrooted - if [ ! -d /run/systemd/system ]; then + skip_chrooted + + if ! systemd-notify --booted; then echo >&2 " Skipped: Current root is not booted." exit 0 fi } udevd_live() { - is_chrooted + systemd_live + if [ ! -S /run/udev/control ]; then echo >&2 " Skipped: Device manager is not running." exit 0 @@ -39,7 +41,7 @@ case "$op" in ;; daemon-reload-user) systemd_live - /usr/bin/systemctl kill --kill-whom='main' --signal='SIGHUP' 'user@*.service' + /usr/bin/systemctl reload 'user@*.service' ;; hwdb) /usr/bin/systemd-hwdb --usr update @@ -66,12 +68,24 @@ case "$op" in fi ;; + # marked with 'systemctl set-property ... Markers=needs-restart' + restart-marked) + systemd_live + /usr/bin/systemctl reload-or-restart --marked + ;; + # For use by other packages reload) systemd_live /usr/bin/systemctl try-reload-or-restart "$@" ;; + # For use by other packages + restart) + systemd_live + /usr/bin/systemctl try-restart "$@" + ;; + *) echo >&2 " Invalid operation '$op'" exit 1 -- cgit v1.2.3-70-g09d2