openrc/scripts/shutdown.in
William Hubbs 5427783fdf standardize the default shell
I do not know of a need to have the default shell be a build-time
configurable setting. All *nix systems I am aware of have /bin/sh as a
default posix compatible shell.
If some systems running OpenRC do not make that assumption about
/bin/sh, I will consider bringing this back, so feel free to open an
issue.
2018-12-08 12:06:26 -06:00

30 lines
527 B
Bash

#!/bin/sh
shutdown_arg=
while getopts :akrhPHfFnct: opt; do
case "$opt" in
a) ;;
k) ;;
r) shutdown_arg=--reboot ;;
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
;;
esac
done
shift $((OPTIND-1))
if [ -z "${shutdown_arg}" ]; then
shutdown_arg=--single
fi
echo @SBINDIR@/openrc-shutdown ${shutdown_arg} "$@"
exec @SBINDIR@/openrc-shutdown ${shutdown_arg} "$@"