summaryrefslogtreecommitdiff
path: root/systemd-hook
diff options
context:
space:
mode:
authorThorsten Töpper <atsutane-aur@freethoughts.de>2025-10-03 00:05:56 +0200
committerThorsten Töpper <atsutane@freethoughts.de>2025-10-03 00:05:56 +0200
commitd46cb14d80310c8081ec12e21df9445b5c1bc91d (patch)
tree218124ea2bc4f44e1e902b7d5027817ad5136c16 /systemd-hook
parent5d6462c45081611f6c7717b5a360929b23799153 (diff)
downloadsystemd-git-d46cb14d80310c8081ec12e21df9445b5c1bc91d.tar.gz
systemd-git-d46cb14d80310c8081ec12e21df9445b5c1bc91d.tar.bz2
Functionally in sync with core/systemd 258-4.
Diffstat (limited to 'systemd-hook')
-rw-r--r--systemd-hook24
1 files changed, 19 insertions, 5 deletions
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