summaryrefslogtreecommitdiff
path: root/nonsystemd/openrc/openrc-hook
diff options
context:
space:
mode:
Diffstat (limited to 'nonsystemd/openrc/openrc-hook')
-rw-r--r--nonsystemd/openrc/openrc-hook15
1 files changed, 14 insertions, 1 deletions
diff --git a/nonsystemd/openrc/openrc-hook b/nonsystemd/openrc/openrc-hook
index d7777e1ae..edeab0500 100644
--- a/nonsystemd/openrc/openrc-hook
+++ b/nonsystemd/openrc/openrc-hook
@@ -7,6 +7,19 @@ openrc_live() {
fi
}
+reexec_init() {
+ local init="$(pacman -Qsq ^init$)"
+
+ if [ $init = openrc-init ]; then
+ /usr/bin/openrc-shutdown -R
+ elif [ $init = sysvinit ]; then
+ /usr/bin/init u
+ else
+ echo >&2 " WARNING: Unidentified init."
+ exit 0
+ fi
+}
+
each_conf() {
while read -r f; do
"$@" "/$f"
@@ -18,7 +31,7 @@ op="$1"; shift
case $op in
sysctl) openrc_live; each_conf /usr/bin/sysctl -q -p ;;
binfmt) openrc_live; each_conf /usr/lib/openrc/sh/binfmt.sh ;;
- reexec) openrc_live; /usr/bin/openrc-shutdown -R ;;
+ reexec) openrc_live; reexec_init ;;
# For use by other packages
reload) openrc_live; /usr/bin/rc-service "$@" reload ;;
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;