From 74a6d02cf7a9ecf9d0a2cdd287e8b7a4ef747679 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 6 Feb 2024 00:32:08 +0100 Subject: [PATCH] Update power.sh --- src/power.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/power.sh b/src/power.sh index e5a0913..cb9a51f 100644 --- a/src/power.sh +++ b/src/power.sh @@ -11,6 +11,7 @@ QEMU_PTY="/run/shm/qemu.pty" QEMU_LOG="/run/shm/qemu.log" QEMU_OUT="/run/shm/qemu.out" QEMU_END="/run/shm/qemu.end" + BOOT_LINE="Windows Boot Manager" rm -f /run/shm/qemu.* @@ -41,9 +42,9 @@ finish() { done fi - if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$QEMU_PTY" ]; then - if grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then - if [ -f "$STORAGE/$BASE" ]; then + if [ -f "$STORAGE/$BASE" ] && [ ! -f "$STORAGE/windows.boot" ]; then + if [ -f "$QEMU_PTY" ]; then + if grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then rm -f "$STORAGE/$BASE" touch "$STORAGE/windows.boot" fi @@ -126,10 +127,11 @@ _graceful_shutdown() { finish "$code" && return "$code" 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 - info "Cannot send ACPI signal during Windows setup, aborting..." - finish "$code" && return "$code" + info "$abort" && finish "$code" && return "$code" fi fi