diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2017-07-11 11:53:23 -0500 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2017-07-11 11:53:23 -0500 |
commit | 03a461ac0ee34b7900868cdea624c6fd868b1656 (patch) | |
tree | a8523f32f6ff1d4f22918aa5cc64354bec8cbfe1 /scripts | |
parent | 7e0f76e0adc545c74a8332a6ef0811d2aa62cb81 (diff) |
fix sysvinit compatibility for reboot wrapper
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/reboot.in | 24 |
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} "$@" |