summaryrefslogtreecommitdiff
path: root/nonsystemd/openrc/openrc-hook
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2019-11-12 23:35:24 -0300
committerDavid P <megver83@parabola.nu>2019-11-12 23:35:24 -0300
commite77ff396b67564f497ee1868d5cddfc1eeeffd2e (patch)
tree1c1d7780148130ad773663503546afc5b5472ba7 /nonsystemd/openrc/openrc-hook
parentc46585d255183aa1cfbfc077ae56d7a1eba12f4b (diff)
downloadabslibre-e77ff396b67564f497ee1868d5cddfc1eeeffd2e.tar.gz
abslibre-e77ff396b67564f497ee1868d5cddfc1eeeffd2e.tar.bz2
abslibre-e77ff396b67564f497ee1868d5cddfc1eeeffd2e.zip
addpkg: nonsystemd/openrc 0.42.1-1
Signed-off-by: David P <megver83@parabola.nu>
Diffstat (limited to 'nonsystemd/openrc/openrc-hook')
-rw-r--r--nonsystemd/openrc/openrc-hook27
1 files changed, 27 insertions, 0 deletions
diff --git a/nonsystemd/openrc/openrc-hook b/nonsystemd/openrc/openrc-hook
new file mode 100644
index 000000000..d7777e1ae
--- /dev/null
+++ b/nonsystemd/openrc/openrc-hook
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+
+openrc_live() {
+ if [ ! -f /run/openrc/softlevel ]; then
+ echo >&2 " Skipped: Current root is not booted."
+ exit 0
+ fi
+}
+
+each_conf() {
+ while read -r f; do
+ "$@" "/$f"
+ done
+}
+
+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 ;;
+ # For use by other packages
+ reload) openrc_live; /usr/bin/rc-service "$@" reload ;;
+ *) echo >&2 " Invalid operation '$op'"; exit 1 ;;
+esac
+
+exit 0