feat: Reuse image cleanup helper after installation (#2095)

This commit is contained in:
Kroese
2026-08-07 06:24:04 +02:00
committed by GitHub
parent ffc9f02c83
commit ed8dcea704
2 changed files with 7 additions and 21 deletions
+6 -20
View File
@@ -14,7 +14,7 @@ startWindows() {
if ! hasImage "$ISO"; then if ! hasImage "$ISO"; then
if ! downloadImage "$ISO" "$VERSION" "$LANGUAGE"; then if ! downloadImage "$ISO" "$VERSION" "$LANGUAGE"; then
removeIso "$ISO" || : removeImage "$ISO" || :
exit 68 exit 68
fi fi
fi fi
@@ -59,7 +59,7 @@ selectWindowsImage() {
fi fi
if ! extractImage "$iso" "$dir" "$VERSION"; then if ! extractImage "$iso" "$dir" "$VERSION"; then
removeIso "$iso" || : removeImage "$iso" || :
return 72 return 72
fi fi
@@ -87,7 +87,7 @@ selectWindowsImage() {
fi fi
if ! extractImage "$iso" "$dir" "$VERSION"; then if ! extractImage "$iso" "$dir" "$VERSION"; then
removeIso "$iso" || : removeImage "$iso" || :
return 74 return 74
fi fi
@@ -182,7 +182,7 @@ prepareWindowsImage() {
# Extracted modern sources and SIF-based legacy media require a clean rebuild. # Extracted modern sources and SIF-based legacy media require a clean rebuild.
if (( ! extracted )); then if (( ! extracted )); then
if ! extractImage "$iso" "$dir" "$VERSION"; then if ! extractImage "$iso" "$dir" "$VERSION"; then
removeIso "$iso" || : removeImage "$iso" || :
return 90 return 90
fi fi
fi fi
@@ -394,7 +394,6 @@ useOriginalImage() {
if [ -n "$CUSTOM" ]; then if [ -n "$CUSTOM" ]; then
BOOT="$iso" BOOT="$iso"
REMOVE="N"
return 0 return 0
fi fi
@@ -623,13 +622,13 @@ hasImage() {
[ -f "$file" ] && [ -s "$file" ] [ -f "$file" ] && [ -s "$file" ]
} }
removeIso() { removeImage() {
local iso="$1" local iso="$1"
[ -n "$CUSTOM" ] && return 0 [ -n "$CUSTOM" ] && return 0
rm -f -- "$iso" 2>/dev/null || : rm -f -- "$iso" 2>/dev/null || warn "failed to remove image \"$iso\"!"
return 0 return 0
} }
@@ -1233,18 +1232,6 @@ createOverlay() {
return 0 return 0
} }
removeImage() {
local iso="$1"
[ ! -f "$iso" ] && return 0
[ -n "$CUSTOM" ] && return 0
rm -f "$iso" 2> /dev/null || warn "failed to remove $iso !"
return 0
}
reserveSambaPorts() { reserveSambaPorts() {
disabled "${SAMBA:-Y}" && return 0 disabled "${SAMBA:-Y}" && return 0
@@ -1463,7 +1450,6 @@ setMachine() {
if [[ "${id,,}" == "reactos" ]] && [ -z "$CUSTOM" ]; then if [[ "${id,,}" == "reactos" ]] && [ -z "$CUSTOM" ]; then
# The ISO is a Live-CD so we need to disable the data disk # The ISO is a Live-CD so we need to disable the data disk
# as it will be always wiped during the next runs currently. # as it will be always wiped during the next runs currently.
REMOVE="N"
DISK_DISABLE="Y" DISK_DISABLE="Y"
fi fi
+1 -1
View File
@@ -405,7 +405,7 @@ markWindowsBooted() {
fi fi
if ! disabled "$REMOVE"; then if ! disabled "$REMOVE"; then
rm -f "$BOOT" 2>/dev/null || : removeImage "$BOOT" || :
fi fi
rm -f "$STORAGE/setup.img" 2>/dev/null || : rm -f "$STORAGE/setup.img" 2>/dev/null || :