fix sysvinit compatibility for shutdown wrapper

This commit is contained in:
William Hubbs 2017-07-11 14:41:29 -05:00
parent 03a461ac0e
commit e7807b3136

View File

@ -1,21 +1,29 @@
#!@SHELL@ #!@SHELL@
poweroff_arg= shutdown_arg=
while getopts :HhPr opt; do while getopts :akrhPHfFnct: opt; do
case "$opt" in case "$opt" in
h|P) poweroff_arg=--poweroff ;; a) ;;
H) poweroff_arg=--halt ;; k) ;;
r) poweroff_arg=--reboot ;; r) shutdown_arg=--reboot ;;
\?) printf "${0##*/}: invalid option ${optarg}\n" >&2 h) shutdown_arg=--halt ;;
P) shutdown_arg=--poweroff ;;
H) shutdown_arg=--halt ;;
f) ;;
F) ;;
n) ;;
c) ;;
t) ;;
[?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
exit 1 exit 1
;; ;;
esac esac
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
if [ -z "${poweroff_arg}" ]; then if [ -z "${shutdown_arg}" ]; then
poweroff_arg=--single shutdown_arg=--single
fi fi
echo @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@} echo @SBINDIR@/openrc-shutdown ${shutdown_arg} "$@"
exec @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@} exec @SBINDIR@/openrc-shutdown ${shutdown_arg} "$@"