aboutsummaryrefslogtreecommitdiff
path: root/scripts/halt.in
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-07-10 18:23:01 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-07-10 18:36:24 -0500
commit9812ce5b8dc22fe36cc7bf75cf6e62db204ece3d (patch)
tree1e3a754475e850963a397e79403a32df9239136f /scripts/halt.in
parent12f75e4167f84a9a85f69924ebdb28ad36c085cb (diff)
fix halt wrapper so it is sysvinit compatible
This makes the halt wrapper sysvinit compatible. It ignores several command line switches which are not currently implemented; however, those can be implemented if we need to do so. This fixes https://github.com/openrc/openrc/issues/146.
Diffstat (limited to 'scripts/halt.in')
-rw-r--r--scripts/halt.in23
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/halt.in b/scripts/halt.in
index 68b13be1..257cc2a7 100644
--- a/scripts/halt.in
+++ b/scripts/halt.in
@@ -1,3 +1,24 @@
#!@SHELL@
-exec @SBINDIR@/openrc-shutdown --halt "$@"
+option_arg=
+poweroff_arg=
+while getopts :nwdfiph opt; do
+ case "$opt" in
+ n) ;;
+ w) poweroff_arg=--write-only ;;
+ d) option_arg=--no-write ;;
+ f) ;;
+ i) ;;
+ p) poweroff_arg=--poweroff ;;
+ [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${poweroff_arg}" ]; then
+ poweroff_arg=--poweroff
+fi
+
+exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@"