mirror of
https://github.com/dockur/windows.git
synced 2026-08-24 15:48:59 +01:00
fix: Handle temporary cleanup failures (#2096)
This commit is contained in:
+18
-10
@@ -309,21 +309,16 @@ startInstall() {
|
||||
ISO="$TMP/$file"
|
||||
fi
|
||||
|
||||
# Work from the temporary directory so the persistent source path can
|
||||
# later contain either the preserved ISO or the rebuilt installation image.
|
||||
if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then
|
||||
if ! mv -f -- "$BOOT" "$ISO"; then
|
||||
error "Failed to move ISO file from \"$BOOT\" to \"$ISO\" !"
|
||||
exit 50
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Keep reusable media at its persistent path until all storage cleanup has
|
||||
# completed successfully, so a later failure cannot strand it under $TMP.
|
||||
if [ -n "$CUSTOM" ] || [ -z "$REUSED_ISO" ]; then
|
||||
if ! rm -f -- "$BOOT"; then
|
||||
error "Failed to remove obsolete ISO file \"$BOOT\" !"
|
||||
exit 50
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! find "$STORAGE" -maxdepth 1 -type f -iname 'data.*' -not -iname '*.iso' -delete; then
|
||||
error "Failed to remove obsolete disk files from \"$STORAGE\" !"
|
||||
@@ -344,6 +339,15 @@ startInstall() {
|
||||
checkMemory "$VERSION" || exit 67
|
||||
fi
|
||||
|
||||
# Work from the temporary directory so the persistent source path can
|
||||
# later contain either the preserved ISO or the rebuilt installation image.
|
||||
if [ -z "$CUSTOM" ] && [ -f "$BOOT" ] && [ -s "$BOOT" ]; then
|
||||
if ! mv -f -- "$BOOT" "$ISO"; then
|
||||
error "Failed to move ISO file from \"$BOOT\" to \"$ISO\" !"
|
||||
exit 50
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -548,7 +552,11 @@ finishInstall() {
|
||||
|
||||
reserveSambaPorts || return 1
|
||||
|
||||
rm -rf "$TMP"
|
||||
if ! rm -rf -- "$TMP"; then
|
||||
error "Failed to remove directory \"$TMP\" !"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user