PKGBUILDs/core/systemd/systemd-hook

38 lines
963 B
Text
Raw Normal View History

2018-03-08 01:30:53 +00:00
#!/bin/sh -e
systemd_live() {
if [ ! -d /run/systemd/system ]; then
echo >&2 " Skipped: Current root is not booted."
exit 0
fi
}
udevd_live() {
if [ ! -d /run/udev ]; then
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
2018-03-08 01:30:53 +00:00
catalog) /usr/bin/journalctl --update-catalog ;;
hwdb) /usr/bin/systemd-hwdb --usr update ;;
update) touch -c /usr ;;
2018-06-14 13:09:05 +00:00
sysusers) /usr/bin/systemd-sysusers ;;
tmpfiles) /usr/bin/systemd-tmpfiles --create ;;
2018-03-08 01:30:53 +00:00
daemon-reload) systemd_live; /usr/bin/systemctl daemon-reload ;;
udev-reload) udevd_live; /usr/bin/udevadm control --reload ;;
2018-06-14 13:09:05 +00:00
binfmt) systemd_live; /usr/lib/systemd/systemd-binfmt ;;
sysctl) systemd_live; /usr/lib/systemd/systemd-sysctl ;;
2018-03-08 01:30:53 +00:00
2019-08-17 14:29:45 +00:00
# For use by other packages
reload) systemd_live; /usr/bin/systemctl try-reload-or-restart "$@" ;;
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
2018-03-08 01:30:53 +00:00
esac
exit 0