summaryrefslogtreecommitdiff
path: root/bin/menuscripts
diff options
context:
space:
mode:
Diffstat (limited to 'bin/menuscripts')
-rwxr-xr-xbin/menuscripts/mpower26
1 files changed, 19 insertions, 7 deletions
diff --git a/bin/menuscripts/mpower b/bin/menuscripts/mpower
index d96e09a..4c5d5e5 100755
--- a/bin/menuscripts/mpower
+++ b/bin/menuscripts/mpower
@@ -5,31 +5,43 @@ then
choice="$1"
else
choice="$(
- cat <<EOF | commander -c -w 1 -y 8
+ cat <<EOF | commander -c -w 1 -y 9
poweroff
suspend
reboot
firmware
hibernate
windows
+bwindows
EOF
)"
fi
>&2 printf 'choice: %s\n' "$choice"
-# Same on both
-case "$choice" in
- "windows")
- NextBoot="$(efibootmgr -u | grep 'Windows' | grep '^Boot[0-9]\{4\}' | cut -c 5-8)"
- expect -f - <<EOF
+windows()
+{
+ NextBoot="$(efibootmgr -u | grep 'Windows' | grep '^Boot[0-9]\{4\}' | cut -c 5-8)"
+ expect -f - <<EOF
set pw [exec pass show aluc]
spawn doas efibootmgr --bootnext "$NextBoot" -u
expect "password:"
send "\$pw\r"
expect eof
EOF
- choice="reboot" ;;
+
+}
+
+# Same on both
+case "$choice" in
+ "bwindows")
+ windows
+ choice="hibernate"
+ ;;
+ "windows")
+ windows
+ choice="reboot"
+ ;;
"firmware") rebootfw; exit ;;
esac