summaryrefslogtreecommitdiff
path: root/bin/menuscripts/mpower
blob: fb7249d39c78b440795c921b8e5bbb5b0ae98a58 (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
#!/bin/sh
choice="$(
cat <<EOF | commander -c -w 1 -y 5
poweroff
suspend
reboot
firmware
hibernate
EOF
)"

if [ "$(hostname)" = "winter" ]; then 
	if [ "$choice" = "firmware" ]; then
		systemctl reboot --firmware-setup
		exit
	fi
	systemctl "$choice"
	exit
fi

case "$choice" in
	"suspend") doas /usr/sbin/zzz ;;
	"poweroff") doas /usr/sbin/poweroff ;;
	"reboot"|"firmware") doas /usr/sbin/reboot ;;
	"") exit 1 ;;
	*) ;;
esac