aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-07-11 11:53:23 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-07-11 11:53:23 -0500
commit03a461ac0ee34b7900868cdea624c6fd868b1656 (patch)
treea8523f32f6ff1d4f22918aa5cc64354bec8cbfe1 /scripts
parent7e0f76e0adc545c74a8332a6ef0811d2aa62cb81 (diff)
fix sysvinit compatibility for reboot wrapper
Diffstat (limited to 'scripts')
-rw-r--r--scripts/reboot.in24
1 files changed, 23 insertions, 1 deletions
diff --git a/scripts/reboot.in b/scripts/reboot.in
index 4da78bb7..c805ceb2 100644
--- a/scripts/reboot.in
+++ b/scripts/reboot.in
@@ -1,3 +1,25 @@
#!@SHELL@
-exec @SBINDIR@/openrc-shutdown --reboot "$@"
+option_arg=
+poweroff_arg=
+while getopts :nwdfhik opt; do
+ case "$opt" in
+ n) ;;
+ w) poweroff_arg=--write-only ;;
+ d) option_arg=--no-write ;;
+ f) ;;
+ h) ;;
+ i) ;;
+ k) poweroff_arg=--kexec ;;
+ [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${poweroff_arg}" ]; then
+ poweroff_arg=--reboot
+fi
+
+exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@"