summaryrefslogtreecommitdiff
path: root/bin/menuscripts
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-10-10 11:03:04 +0200
committerRaymaekers Luca <luca@spacehb.net>2025-10-10 11:03:04 +0200
commitda5908fe194a2036dcd1b1d9af70159acca63063 (patch)
tree7ca9628b3345c1888b0f340a40ab3e6ff1d52054 /bin/menuscripts
parent4f126573a547b5430962be6051b8705af281ff5a (diff)
checkpoint
Diffstat (limited to 'bin/menuscripts')
-rwxr-xr-xbin/menuscripts/mpower30
1 files changed, 21 insertions, 9 deletions
diff --git a/bin/menuscripts/mpower b/bin/menuscripts/mpower
index 8cbf1d0..8886cfd 100755
--- a/bin/menuscripts/mpower
+++ b/bin/menuscripts/mpower
@@ -1,29 +1,41 @@
#!/bin/sh
choice="$(
-cat <<EOF | commander -c -w 1 -y 7
+cat <<EOF | commander -c -w 1 -y 8
poweroff
suspend
reboot
firmware
hibernate
+windows
EOF
)"
+# Same on both
+case "$choice" in
+ "windows")
+ doas efibootmgr --bootnext "$(efibootmgr -u | grep 'Windows' | grep '^Boot[0-9]\{4\}' | cut -c 5-8)"
+ doas reboot
+ exit
+ ;;
+ "firmware") rebootfw; exit ;;
+esac
+
+# Winter
if [ "$(hostname)" = "winter" ]; then
- if [ "$choice" = "firmware" ]; then
- systemctl reboot --firmware-setup
- elif [ "$choice" = "suspend" ]; then
- systemctl hybrid-sleep
- else
- systemctl "$choice"
- fi
+ case "$choice" in
+ "suspend") systemctl hybrid-sleep ;;
+ "") exit 1 ;;
+ *) systemctl "$choice" ;;
+ esac
+# Spring
elif [ "$(hostname)" = "spring" ]; then
case "$choice" in
"suspend") doas /usr/sbin/zzz -H ;;
"hibernate") doas /usr/sbin/zzz -Z ;;
"poweroff") doas /usr/sbin/poweroff ;;
"reboot") doas /usr/sbin/reboot ;;
- "firmware") rebootfw ;;
+ "windows")
+ ;;
"") exit 1 ;;
*) ;;
esac