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:
+39
-4
@@ -279,9 +279,15 @@ startInstall() {
|
|||||||
skipInstall "$BOOT" "$previousBase" && return 1
|
skipInstall "$BOOT" "$previousBase" && return 1
|
||||||
|
|
||||||
if [ -z "$previousBase" ] && hasData; then
|
if [ -z "$previousBase" ] && hasData; then
|
||||||
if ! backupPrevious ""; then
|
|
||||||
warn "the backup was incomplete, continuing with installation..."
|
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
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! makeDir "$TMP"; then
|
if ! makeDir "$TMP"; then
|
||||||
@@ -374,7 +380,7 @@ skipUnattended() {
|
|||||||
|
|
||||||
# Preserve custom media in place. Downloaded or reused media must be moved
|
# Preserve custom media in place. Downloaded or reused media must be moved
|
||||||
# back to persistent storage before the manual fallback is started.
|
# back to persistent storage before the manual fallback is started.
|
||||||
useOriginalImage "$iso"
|
useOriginalImage "$iso" || return 1
|
||||||
|
|
||||||
finishInstall "$BOOT" "$aborted" "$boot" && return 0
|
finishInstall "$BOOT" "$aborted" "$boot" && return 0
|
||||||
return 1
|
return 1
|
||||||
@@ -467,6 +473,11 @@ skipInstall() {
|
|||||||
fi
|
fi
|
||||||
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..."
|
info "Detected that $method, a backup of your previous installation will be saved..."
|
||||||
|
|
||||||
if ! backupPrevious "$STORAGE/$previousBase"; then
|
if ! backupPrevious "$STORAGE/$previousBase"; then
|
||||||
@@ -624,7 +635,10 @@ removeImage() {
|
|||||||
|
|
||||||
[ -n "$CUSTOM" ] && return 0
|
[ -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
|
return 0
|
||||||
}
|
}
|
||||||
@@ -1264,6 +1278,27 @@ reserveSambaPorts() {
|
|||||||
return 0
|
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 () {
|
backupPrevious () {
|
||||||
|
|
||||||
local iso="$1"
|
local iso="$1"
|
||||||
|
|||||||
+1
-4
@@ -1379,10 +1379,7 @@ fallbackEnglish() {
|
|||||||
# still locate the same image, but use English installation media.
|
# still locate the same image, but use English installation media.
|
||||||
LANGUAGE="en"
|
LANGUAGE="en"
|
||||||
|
|
||||||
if ! rm -f -- "$iso"; then
|
removeImage "$iso" || return 1
|
||||||
error "Failed to remove ISO file \"$iso\" !"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
downloadImage "$iso" "$version" "$LANGUAGE"
|
downloadImage "$iso" "$version" "$LANGUAGE"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user