From 367f70bd2816d66abb20a6c940ae982a3a1c1ed8 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 4 Feb 2024 17:20:06 +0100 Subject: [PATCH] Update install.sh --- src/install.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/install.sh b/src/install.sh index 258dfec..c6d34ce 100644 --- a/src/install.sh +++ b/src/install.sh @@ -525,18 +525,25 @@ extractESD() { local iso="$1" local dir="$2" - local size desc + local size size_gb space space_gb desc desc=$(printVersion "$VERSION") local msg="Extracting $desc bootdisk..." info "$msg" && html "$msg" size=$(stat -c%s "$iso") + size_gb=$(( (size + 1073741823)/1073741824 )) + space=$(df --output=avail -B 1 "$TMP" | tail -n 1) + space_gb=$(( (space + 1073741823)/1073741824 )) if ((size<10000000)); then error "Invalid ESD file: Size is smaller than 10 MB" && exit 62 fi + if (( size > space )); then + error "Not enough free space in $STORAGE, have $space_gb GB available but need at least $size_gb GB." && exit 63 + fi + rm -rf "$dir" mkdir -p "$dir" @@ -606,6 +613,14 @@ extractImage() { local desc="downloaded ISO" local size size_gb space space_gb + if [[ "${iso,,}" == *".esd" ]]; then + if ! extractESD "$iso" "$dir"; then + error "Failed to extract ESD file!" + exit 67 + fi + return 0 + fi + if [[ "$EXTERNAL" != [Yy1]* ]] && [ -z "$CUSTOM" ]; then desc=$(printVersion "$VERSION") [ -z "$desc" ] && desc="downloaded ISO"