mirror of
https://github.com/dockur/windows.git
synced 2026-08-24 07:39:00 +01:00
fix: Do not backup unfinished installations (#2103)
This commit is contained in:
+37
-2
@@ -279,11 +279,17 @@ startInstall() {
|
||||
skipInstall "$BOOT" "$previousBase" && return 1
|
||||
|
||||
if [ -z "$previousBase" ] && hasData; then
|
||||
|
||||
if enabled "$SHUTDOWN" && [ ! -f "$STORAGE/windows.boot" ]; then
|
||||
discardPrevious "" || exit 50
|
||||
else
|
||||
if ! backupPrevious ""; then
|
||||
warn "the backup was incomplete, continuing with installation..."
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if ! makeDir "$TMP"; then
|
||||
error "Failed to create directory \"$TMP\" !"
|
||||
exit 50
|
||||
@@ -374,7 +380,7 @@ skipUnattended() {
|
||||
|
||||
# Preserve custom media in place. Downloaded or reused media must be moved
|
||||
# back to persistent storage before the manual fallback is started.
|
||||
useOriginalImage "$iso"
|
||||
useOriginalImage "$iso" || return 1
|
||||
|
||||
finishInstall "$BOOT" "$aborted" "$boot" && return 0
|
||||
return 1
|
||||
@@ -467,6 +473,11 @@ skipInstall() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if enabled "$SHUTDOWN" && [ ! -f "$boot" ]; then
|
||||
discardPrevious "$STORAGE/$previousBase" || exit 50
|
||||
return 1
|
||||
fi
|
||||
|
||||
info "Detected that $method, a backup of your previous installation will be saved..."
|
||||
|
||||
if ! backupPrevious "$STORAGE/$previousBase"; then
|
||||
@@ -624,7 +635,10 @@ removeImage() {
|
||||
|
||||
[ -n "$CUSTOM" ] && return 0
|
||||
|
||||
rm -f -- "$iso" 2>/dev/null || warn "failed to remove image \"$iso\"!"
|
||||
if ! rm -f -- "$iso" 2>/dev/null; then
|
||||
warn "failed to remove image \"$iso\"!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -1264,6 +1278,27 @@ reserveSambaPorts() {
|
||||
return 0
|
||||
}
|
||||
|
||||
discardPrevious() {
|
||||
|
||||
local iso="$1"
|
||||
|
||||
if [ -n "$iso" ] && [ -f "$iso" ]; then
|
||||
if ! rm -f -- "$iso"; then
|
||||
error "Failed to remove ISO file \"$iso\" !"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! find "$STORAGE" -maxdepth 1 -type f \
|
||||
\( -iname 'data.*' -or -iname 'windows.*' -or -iname '*.rom' -or -iname '*.vars' \) \
|
||||
-not -iname '*.iso' -delete; then
|
||||
error "Failed to remove unfinished installation files from \"$STORAGE\" !"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
backupPrevious () {
|
||||
|
||||
local iso="$1"
|
||||
|
||||
+1
-4
@@ -1379,10 +1379,7 @@ fallbackEnglish() {
|
||||
# still locate the same image, but use English installation media.
|
||||
LANGUAGE="en"
|
||||
|
||||
if ! rm -f -- "$iso"; then
|
||||
error "Failed to remove ISO file \"$iso\" !"
|
||||
return 1
|
||||
fi
|
||||
removeImage "$iso" || return 1
|
||||
|
||||
downloadImage "$iso" "$version" "$LANGUAGE"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user