mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 03:15:49 +00:00
fix: Verify files are not empty (#383)
This commit is contained in:
parent
2a98081549
commit
8a5f233e34
3 changed files with 29 additions and 26 deletions
14
src/power.sh
14
src/power.sh
|
|
@ -25,7 +25,7 @@ _trap() {
|
|||
ready() {
|
||||
|
||||
[ -f "$STORAGE/windows.boot" ] && return 0
|
||||
[ ! -f "$QEMU_PTY" ] && return 1
|
||||
[ ! -s "$QEMU_PTY" ] && return 1
|
||||
|
||||
if [ -f "$STORAGE/windows.old" ]; then
|
||||
local last
|
||||
|
|
@ -52,7 +52,7 @@ finish() {
|
|||
|
||||
touch "$QEMU_END"
|
||||
|
||||
if [ -f "$QEMU_PID" ]; then
|
||||
if [ -s "$QEMU_PID" ]; then
|
||||
|
||||
pid=$(<"$QEMU_PID")
|
||||
error "Forcefully terminating Windows, reason: $reason..."
|
||||
|
|
@ -61,7 +61,7 @@ finish() {
|
|||
while isAlive "$pid"; do
|
||||
sleep 1
|
||||
# Workaround for zombie pid
|
||||
[ ! -f "$QEMU_PID" ] && break
|
||||
[ ! -s "$QEMU_PID" ] && break
|
||||
done
|
||||
fi
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ finish() {
|
|||
fi
|
||||
|
||||
pid="/var/run/tpm.pid"
|
||||
[ -f "$pid" ] && pKill "$(<"$pid")"
|
||||
[ -s "$pid" ] && pKill "$(<"$pid")"
|
||||
|
||||
fKill "wsdd"
|
||||
fKill "smbd"
|
||||
|
|
@ -91,7 +91,7 @@ terminal() {
|
|||
|
||||
local dev=""
|
||||
|
||||
if [ -f "$QEMU_OUT" ]; then
|
||||
if [ -s "$QEMU_OUT" ]; then
|
||||
|
||||
local msg
|
||||
msg=$(<"$QEMU_OUT")
|
||||
|
|
@ -139,7 +139,7 @@ _graceful_shutdown() {
|
|||
touch "$QEMU_END"
|
||||
info "Received $1, sending ACPI shutdown signal..."
|
||||
|
||||
if [ ! -f "$QEMU_PID" ]; then
|
||||
if [ ! -s "$QEMU_PID" ]; then
|
||||
error "QEMU PID file does not exist?"
|
||||
finish "$code" && return "$code"
|
||||
fi
|
||||
|
|
@ -168,7 +168,7 @@ _graceful_shutdown() {
|
|||
|
||||
! isAlive "$pid" && break
|
||||
# Workaround for zombie pid
|
||||
[ ! -f "$QEMU_PID" ] && break
|
||||
[ ! -s "$QEMU_PID" ] && break
|
||||
|
||||
info "Waiting for Windows to shutdown... ($cnt/$QEMU_TIMEOUT)"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue