From 56cb787c55a076fcc86d679d0bf592bb6ba5548d Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 13 Apr 2024 16:58:04 +0200 Subject: [PATCH] fix: Delete ISO when extraction fails (#372) --- .dockerignore | 4 +++- src/install.sh | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 2cf7b5a..258778b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,6 +6,8 @@ .gitmodules Dockerfile Dockerfile.archive +compose.yml +compose.yaml docker-compose.yml - +docker-compose.yaml *.md diff --git a/src/install.sh b/src/install.sh index 35df436..0e2be7a 100644 --- a/src/install.sh +++ b/src/install.sh @@ -316,6 +316,7 @@ startInstall() { fi + rm -rf "$TMP" mkdir -p "$TMP" if [ ! -f "$STORAGE/$CUSTOM" ]; then @@ -325,7 +326,6 @@ startInstall() { ISO="$STORAGE/$CUSTOM" fi - rm -f "$TMP/$BASE" return 0 } @@ -445,6 +445,9 @@ downloadImage() { info "Failed to download $desc using Mido, will try a different method now..." + rm -rf "$TMP" + mkdir -p "$TMP" + ISO="$TMP/$VERSION.esd" iso="$ISO" file="$ISO" @@ -573,6 +576,7 @@ extractImage() { if [[ "${iso,,}" == *".esd" ]]; then if ! extractESD "$iso" "$dir"; then + rm -f "$iso" error "Failed to extract ESD file!" exit 67 fi @@ -604,6 +608,7 @@ extractImage() { rm -rf "$dir" if ! 7z x "$iso" -o"$dir" > /dev/null; then + rm -f "$iso" error "Failed to extract ISO file!" exit 66 fi