@@ -11,6 +11,7 @@ QEMU_PTY="/run/shm/qemu.pty"
11
11
QEMU_LOG=" /run/shm/qemu.log"
12
12
QEMU_OUT=" /run/shm/qemu.out"
13
13
QEMU_END=" /run/shm/qemu.end"
14
+ BOOT_LINE=" starting Boot0002"
14
15
15
16
rm -f /run/shm/qemu.*
16
17
touch " $QEMU_LOG "
@@ -40,6 +41,15 @@ finish() {
40
41
done
41
42
fi
42
43
44
+ if [ ! -f " $STORAGE /windows.boot" ] && [ -f " $QEMU_PTY " ]; then
45
+ if grep -Fq " $BOOT_LINE " " $QEMU_PTY " ; then
46
+ if [ -f " $STORAGE /$BASE " ]; then
47
+ rm -f " $STORAGE /$BASE "
48
+ touch " $STORAGE /windows.boot"
49
+ fi
50
+ fi
51
+ fi
52
+
43
53
pid=" /var/run/tpm.pid"
44
54
[ -f " $pid " ] && pKill " $( < " $pid " ) "
45
55
@@ -116,12 +126,8 @@ _graceful_shutdown() {
116
126
finish " $code " && return " $code "
117
127
fi
118
128
119
- local remove_iso=" "
120
-
121
129
if [ ! -f " $STORAGE /windows.boot" ] && [ -f " $QEMU_PTY " ]; then
122
- if grep -Fq " starting Boot0002" " $QEMU_PTY " ; then
123
- [ -f " $STORAGE /$BASE " ] && remove_iso=" y"
124
- else
130
+ if ! grep -Fq " $BOOT_LINE " " $QEMU_PTY " ; then
125
131
info " Cannot send ACPI signal during Windows setup, aborting..."
126
132
finish " $code " && return " $code "
127
133
fi
@@ -149,11 +155,6 @@ _graceful_shutdown() {
149
155
150
156
if [ " $cnt " -ge " $QEMU_TIMEOUT " ]; then
151
157
error " Shutdown timeout reached, aborting..."
152
- else
153
- if [ -n " $remove_iso " ]; then
154
- rm -f " $STORAGE /$BASE "
155
- touch " $STORAGE /windows.boot"
156
- fi
157
158
fi
158
159
159
160
finish " $code " && return " $code "
0 commit comments