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

if [ "$(hostname)" = "winter" ]; then 
	if [ "$choice" = "firmware" ]; then
		systemctl reboot --firmware-setup
	elif [ "$choice" = "eepy" ]; then
		systemctl hybrid-sleep
	else
		systemctl "$choice"
	fi
elif [ "$(hostname)" = "spring" ]; then
	case "$choice" in
		"suspend") doas /usr/sbin/zzz -z ;;
		"hibernate") doas /usr/sbin/zzz -Z ;;
		"eepy") doas /usr/sbin/zzz -H ;;
		"poweroff") doas /usr/sbin/poweroff ;;
		"reboot") doas /usr/sbin/reboot ;;
		"firmware") rebootfw ;;
		"") exit 1 ;;
		*) ;;
	esac 
fi