diff --git a/src/install.sh b/src/install.sh index 5f091cfa..f741ba89 100644 --- a/src/install.sh +++ b/src/install.sh @@ -481,7 +481,6 @@ skipInstall() { local iso="$1" local previousBase="$2" - local marker="$STORAGE/windows.boot" local system if [ -n "$previousBase" ]; then @@ -569,7 +568,7 @@ skipInstall() { return 0 fi - hasData && [ -f "$marker" ] && return 0 + hasData && hasBootMarker && return 0 return 1 } @@ -687,7 +686,6 @@ findFile() { local fname="$1" local dir file base - local marker="$STORAGE/windows.boot" dir=$(find / -maxdepth 1 -type d -iname "$fname" -print -quit) || return 1 @@ -696,7 +694,7 @@ findFile() { fi if [ -d "$dir" ]; then - if ! hasSystemImage && { ! hasDisk || [ ! -f "$marker" ]; }; then + if ! hasSystemImage && { ! hasDisk || ! hasBootMarker; }; then error "The bind $dir maps to a file that does not exist!" && return 1 fi fi @@ -786,6 +784,11 @@ isLegacyBoot() { [[ "${mode,,}" == "windows_legacy" ]] } +hasBootMarker() { + + [ -f "$STORAGE/windows.boot" ] +} + hasImage() { local iso="$1" @@ -828,7 +831,7 @@ hasInstalledDisk() { hasCompletedInstall() { hasSystemImage && return 0 - hasData && [ -f "$STORAGE/windows.boot" ] + hasData && hasBootMarker } needsExtraction() { diff --git a/src/power.sh b/src/power.sh index 9a4e0fbb..027b830c 100644 --- a/src/power.sh +++ b/src/power.sh @@ -261,7 +261,7 @@ ready() { # The marker means installation completed previously, so shutdown # no longer needs to infer guest readiness from firmware output. - [ -f "$STORAGE/windows.boot" ] && return 0 + hasBootMarker && return 0 [ ! -s "$QEMU_PTY" ] && return 1 @@ -384,9 +384,7 @@ getBootMarker() { markWindowsBooted() { - local file="$STORAGE/windows.boot" - - if [ -f "$file" ] || [ ! -f "$BOOT" ]; then + if hasBootMarker || [ ! -f "$BOOT" ]; then return 0 fi @@ -394,14 +392,16 @@ markWindowsBooted() { # now booting from the installed disk rather than from setup media. ready || return 0 - if ! touch "$file"; then + local marker="$STORAGE/windows.boot" + + if ! touch "$marker"; then warn "failed to create Windows installation marker!" return 0 fi - if ! setOwner "$file"; then - rm -f "$file" - warn "failed to set the owner for \"$file\" !" + if ! setOwner "$marker"; then + rm -f "$marker" + warn "failed to set the owner for \"$marker\" !" return 0 fi @@ -430,7 +430,7 @@ finish() { forceKillQemu "$reason" - if [ ! -f "$STORAGE/windows.boot" ]; then + if ! hasBootMarker; then markWindowsBooted fi