Skip to content

Commit

Permalink
fix: Delete ISO when extraction fails (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Apr 13, 2024
1 parent da9ef0e commit 56cb787
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
.gitmodules
Dockerfile
Dockerfile.archive
compose.yml
compose.yaml
docker-compose.yml

docker-compose.yaml
*.md
7 changes: 6 additions & 1 deletion src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ startInstall() {

fi

rm -rf "$TMP"
mkdir -p "$TMP"

if [ ! -f "$STORAGE/$CUSTOM" ]; then
Expand All @@ -325,7 +326,6 @@ startInstall() {
ISO="$STORAGE/$CUSTOM"
fi

rm -f "$TMP/$BASE"
return 0
}

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 56cb787

Please sign in to comment.