mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 11:25:49 +00:00
Update power.sh
This commit is contained in:
parent
471a110b3f
commit
554dd91f7f
1 changed files with 25 additions and 7 deletions
32
src/power.sh
32
src/power.sh
|
|
@ -11,8 +11,10 @@ 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"
|
||||
|
||||
BIOS_LINE="Booting from Hard Disk..."
|
||||
BOOT_LINE="Windows Boot Manager"
|
||||
|
||||
rm -f /run/shm/qemu.*
|
||||
touch "$QEMU_LOG"
|
||||
|
||||
|
|
@ -41,11 +43,20 @@ finish() {
|
|||
done
|
||||
fi
|
||||
|
||||
if [ ! -f "$STORAGE/windows.old" ] && [ ! -f "$STORAGE/windows.boot" ]; 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"
|
||||
if [ ! -f "$STORAGE/windows.old" ]; then
|
||||
if grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then
|
||||
rm -f "$STORAGE/$BASE"
|
||||
touch "$STORAGE/windows.boot"
|
||||
fi
|
||||
else
|
||||
local last
|
||||
last=$(tail -n 1 "$QEMU_PTY")
|
||||
if [[ "${last,,}" == "${BIOS_LINE,,}" ]]; then
|
||||
rm -f "$STORAGE/$BASE"
|
||||
touch "$STORAGE/windows.boot"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
@ -126,12 +137,19 @@ _graceful_shutdown() {
|
|||
finish "$code" && return "$code"
|
||||
fi
|
||||
|
||||
if [ ! -f "$STORAGE/windows.old" ] && [ ! -f "$STORAGE/windows.boot" ]; then
|
||||
if [ -f "$QEMU_PTY" ]; then
|
||||
if [ -f "$QEMU_PTY" ] && [ ! -f "$STORAGE/windows.boot" ]; then
|
||||
if [ ! -f "$STORAGE/windows.old" ]; then
|
||||
if ! grep -Fq "$BOOT_LINE" "$QEMU_PTY"; then
|
||||
info "Cannot send ACPI signal during Windows setup, aborting..."
|
||||
finish "$code" && return "$code"
|
||||
fi
|
||||
else
|
||||
local last
|
||||
last=$(tail -n 1 "$QEMU_PTY")
|
||||
if [[ "${last,,}" != "${BIOS_LINE,,}" ]]; then
|
||||
info "Cannot send ACPI signal during Windows setup, aborting..."
|
||||
finish "$code" && return "$code"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue