2018-03-08 01:30:53 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2024-10-09 10:35:12 +00:00
|
|
|
skip_chrooted() {
|
2021-05-19 14:06:57 +00:00
|
|
|
if systemd-detect-virt --chroot; then
|
|
|
|
echo >&2 " Skipped: Running in chroot."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-03-08 01:30:53 +00:00
|
|
|
systemd_live() {
|
2024-10-09 10:35:12 +00:00
|
|
|
skip_chrooted
|
|
|
|
|
2024-11-15 18:57:13 +00:00
|
|
|
if ! systemd-notify --booted >/dev/null 2>&1; then
|
2018-03-08 01:30:53 +00:00
|
|
|
echo >&2 " Skipped: Current root is not booted."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
udevd_live() {
|
2024-10-09 10:35:12 +00:00
|
|
|
skip_chrooted
|
|
|
|
|
2023-09-28 02:30:42 +00:00
|
|
|
if [ ! -S /run/udev/control ]; then
|
2018-03-08 01:30:53 +00:00
|
|
|
echo >&2 " Skipped: Device manager is not running."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-08-17 14:29:45 +00:00
|
|
|
op="$1"; shift
|
|
|
|
|
|
|
|
case "$op" in
|
2023-12-07 19:09:41 +00:00
|
|
|
binfmt)
|
|
|
|
systemd_live
|
|
|
|
/usr/lib/systemd/systemd-binfmt
|
|
|
|
;;
|
2023-04-11 17:38:16 +00:00
|
|
|
catalog)
|
|
|
|
/usr/bin/journalctl --update-catalog
|
|
|
|
;;
|
2023-12-07 19:09:41 +00:00
|
|
|
daemon-reload-system)
|
|
|
|
systemd_live
|
|
|
|
/usr/bin/systemctl --system daemon-reload
|
|
|
|
;;
|
|
|
|
daemon-reload-user)
|
|
|
|
systemd_live
|
|
|
|
/usr/bin/systemctl kill --kill-whom='main' --signal='SIGHUP' 'user@*.service'
|
|
|
|
;;
|
2023-04-11 17:38:16 +00:00
|
|
|
hwdb)
|
|
|
|
/usr/bin/systemd-hwdb --usr update
|
|
|
|
;;
|
2023-12-07 19:09:41 +00:00
|
|
|
sysctl)
|
|
|
|
systemd_live
|
|
|
|
/usr/lib/systemd/systemd-sysctl
|
2023-04-11 17:38:16 +00:00
|
|
|
;;
|
|
|
|
sysusers)
|
|
|
|
/usr/bin/systemd-sysusers
|
|
|
|
;;
|
|
|
|
tmpfiles)
|
|
|
|
/usr/bin/systemd-tmpfiles --create
|
|
|
|
;;
|
2023-12-07 19:09:41 +00:00
|
|
|
update)
|
|
|
|
touch -c /usr
|
2023-04-11 17:38:16 +00:00
|
|
|
;;
|
|
|
|
udev-reload)
|
|
|
|
udevd_live
|
|
|
|
/usr/bin/udevadm control --reload
|
2023-09-28 02:30:42 +00:00
|
|
|
if [ ! -e /etc/systemd/do-not-udevadm-trigger-on-update ]; then
|
|
|
|
/usr/bin/udevadm trigger -c change
|
|
|
|
/usr/bin/udevadm settle
|
|
|
|
fi
|
2023-04-11 17:38:16 +00:00
|
|
|
;;
|
2018-03-08 01:30:53 +00:00
|
|
|
|
2019-08-17 14:29:45 +00:00
|
|
|
# For use by other packages
|
2023-04-11 17:38:16 +00:00
|
|
|
reload)
|
|
|
|
systemd_live
|
|
|
|
/usr/bin/systemctl try-reload-or-restart "$@"
|
|
|
|
;;
|
2019-08-17 14:29:45 +00:00
|
|
|
|
2023-04-11 17:38:16 +00:00
|
|
|
*)
|
|
|
|
echo >&2 " Invalid operation '$op'"
|
|
|
|
exit 1
|
|
|
|
;;
|
2018-03-08 01:30:53 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|