mirror of
https://github.com/dockur/windows-arm.git
synced 2024-10-06 02:01:18 +00:00
feat: Boot detection (#6)
This commit is contained in:
parent
1c2c8c5e14
commit
d5f4b4784b
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_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="starting Boot0002"
|
||||||
|
|
||||||
rm -f /run/shm/qemu.*
|
rm -f /run/shm/qemu.*
|
||||||
touch "$QEMU_LOG"
|
touch "$QEMU_LOG"
|
||||||
|
@ -40,6 +41,15 @@ finish() {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$QEMU_PTY" ]; then
|
||||||
|
if grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then
|
||||||
|
if [ -f "$STORAGE/$BASE" ]; then
|
||||||
|
rm -f "$STORAGE/$BASE"
|
||||||
|
touch "$STORAGE/windows.boot"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
pid="/var/run/tpm.pid"
|
pid="/var/run/tpm.pid"
|
||||||
[ -f "$pid" ] && pKill "$(<"$pid")"
|
[ -f "$pid" ] && pKill "$(<"$pid")"
|
||||||
|
|
||||||
|
@ -116,12 +126,8 @@ _graceful_shutdown() {
|
||||||
finish "$code" && return "$code"
|
finish "$code" && return "$code"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local remove_iso=""
|
|
||||||
|
|
||||||
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$QEMU_PTY" ]; then
|
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$QEMU_PTY" ]; then
|
||||||
if grep -Fq "starting Boot0002" "$QEMU_PTY"; then
|
if ! grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then
|
||||||
[ -f "$STORAGE/$BASE" ] && remove_iso="y"
|
|
||||||
else
|
|
||||||
info "Cannot send ACPI signal during Windows setup, aborting..."
|
info "Cannot send ACPI signal during Windows setup, aborting..."
|
||||||
finish "$code" && return "$code"
|
finish "$code" && return "$code"
|
||||||
fi
|
fi
|
||||||
|
@ -149,11 +155,6 @@ _graceful_shutdown() {
|
||||||
|
|
||||||
if [ "$cnt" -ge "$QEMU_TIMEOUT" ]; then
|
if [ "$cnt" -ge "$QEMU_TIMEOUT" ]; then
|
||||||
error "Shutdown timeout reached, aborting..."
|
error "Shutdown timeout reached, aborting..."
|
||||||
else
|
|
||||||
if [ -n "$remove_iso" ]; then
|
|
||||||
rm -f "$STORAGE/$BASE"
|
|
||||||
touch "$STORAGE/windows.boot"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
finish "$code" && return "$code"
|
finish "$code" && return "$code"
|
||||||
|
|
Loading…
Reference in a new issue