aboutsummaryrefslogtreecommitdiff
path: root/scripts/shutdown.in
blob: 7d68bf092168a4263e8765e84cf3f1bdb3e6a189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!@SHELL@

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} "$@"