Update power.sh

This commit is contained in:
Kroese 2024-02-06 00:32:08 +01:00 committed by GitHub
parent d4ca6d958b
commit 74a6d02cf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@ QEMU_PTY="/run/shm/qemu.pty"
QEMU_LOG="/run/shm/qemu.log" QEMU_LOG="/run/shm/qemu.log"
QEMU_OUT="/run/shm/qemu.out" QEMU_OUT="/run/shm/qemu.out"
QEMU_END="/run/shm/qemu.end" QEMU_END="/run/shm/qemu.end"
BOOT_LINE="Windows Boot Manager" BOOT_LINE="Windows Boot Manager"
rm -f /run/shm/qemu.* rm -f /run/shm/qemu.*
@ -41,9 +42,9 @@ finish() {
done done
fi fi
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$QEMU_PTY" ]; then if [ -f "$STORAGE/$BASE" ] && [ ! -f "$STORAGE/windows.boot" ]; then
if [ -f "$QEMU_PTY" ]; then
if grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then if grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then
if [ -f "$STORAGE/$BASE" ]; then
rm -f "$STORAGE/$BASE" rm -f "$STORAGE/$BASE"
touch "$STORAGE/windows.boot" touch "$STORAGE/windows.boot"
fi fi
@ -126,10 +127,11 @@ _graceful_shutdown() {
finish "$code" && return "$code" finish "$code" && return "$code"
fi fi
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$QEMU_PTY" ]; then local abort="Cannot send ACPI signal during Windows setup, aborting..."
if [ -f "$QEMU_PTY" ] && [ ! -f "$STORAGE/windows.boot" ]; then
if ! grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then if ! grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then
info "Cannot send ACPI signal during Windows setup, aborting..." info "$abort" && finish "$code" && return "$code"
finish "$code" && return "$code"
fi fi
fi fi