openrc/scripts/shutdown.in
2017-06-12 17:58:18 -05:00

22 lines
428 B
Plaintext

#!@SHELL@
poweroff_arg=
while getopts :HhPr opt; do
case "$opt" in
h|P) poweroff_arg=--poweroff ;;
H) poweroff_arg=--halt ;;
r) poweroff_arg=--reboot ;;
\?) printf "${0##*/}: invalid option ${optarg}\n" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ -z "${poweroff_arg}" ]; then
poweroff_arg=--single
fi
echo @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@}
exec @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@}