mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 11:25:49 +00:00
fix: Detect boot manager
This commit is contained in:
parent
249c5b7731
commit
9c7ea2f6b9
1 changed files with 11 additions and 10 deletions
21
src/power.sh
21
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.*
|
||||
touch "$QEMU_LOG"
|
||||
|
|
@ -40,6 +41,15 @@ finish() {
|
|||
done
|
||||
fi
|
||||
|
||||
if [ ! -f "$STORAGE/windows.old" ]; then
|
||||
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$QEMU_PTY" ]; then
|
||||
if grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then
|
||||
rm -f "$STORAGE/$BASE"
|
||||
touch "$STORAGE/windows.boot"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pid="/var/run/tpm.pid"
|
||||
[ -f "$pid" ] && pKill "$(<"$pid")"
|
||||
|
||||
|
|
@ -116,13 +126,9 @@ _graceful_shutdown() {
|
|||
finish "$code" && return "$code"
|
||||
fi
|
||||
|
||||
local remove_iso=""
|
||||
|
||||
if [ ! -f "$STORAGE/windows.old" ]; then
|
||||
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$QEMU_PTY" ]; then
|
||||
if grep -Fq "Windows Boot Manager" "$QEMU_PTY"; then
|
||||
[ -f "$STORAGE/$BASE" ] && remove_iso="y"
|
||||
else
|
||||
if ! grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then
|
||||
info "Cannot send ACPI signal during Windows setup, aborting..."
|
||||
finish "$code" && return "$code"
|
||||
fi
|
||||
|
|
@ -151,11 +157,6 @@ _graceful_shutdown() {
|
|||
|
||||
if [ "$cnt" -ge "$QEMU_TIMEOUT" ]; then
|
||||
error "Shutdown timeout reached, aborting..."
|
||||
else
|
||||
if [ -n "$remove_iso" ]; then
|
||||
rm -f "$STORAGE/$BASE"
|
||||
touch "$STORAGE/windows.boot"
|
||||
fi
|
||||
fi
|
||||
|
||||
finish "$code" && return "$code"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue