fix: Skip ESD errors

This commit is contained in:
Kroese 2024-04-24 17:56:20 +02:00 committed by GitHub
parent 94c4163851
commit 17a1303234
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,8 +2,10 @@
set -Eeuo pipefail set -Eeuo pipefail
: "${MANUAL:=""}" : "${MANUAL:=""}"
: "${VERSION:=""}"
: "${DETECTED:=""}" : "${DETECTED:=""}"
: "${VERSION:="win11x64"}"
[ -z "$VERSION" ] && VERSION="win11x64"
if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then
VERSION="${VERSION:1:-1}" VERSION="${VERSION:1:-1}"
@ -451,14 +453,20 @@ downloadImage() {
local iso="$1" local iso="$1"
local url="$2" local url="$2"
local file="$iso" local rc=99
local desc rc progress local msg desc progress
rm -f "$iso" rm -f "$iso"
# Check if running with interactive TTY or redirected to docker log
if [ -t 1 ]; then
progress="--progress=bar:noscroll"
else
progress="--progress=dot:giga"
fi
if [[ "$EXTERNAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then
file="$iso.PART"
desc=$(printVersion "$VERSION" "Windows") desc=$(printVersion "$VERSION" "Windows")
else else
@ -467,12 +475,12 @@ downloadImage() {
fi fi
local msg="Downloading $desc..."
info "$msg" && html "$msg"
/run/progress.sh "$file" "Downloading $desc ([P])..." &
if [[ "$EXTERNAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then
msg="Downloading $desc..."
info "$msg" && html "$msg"
/run/progress.sh "$iso.PART" "Downloading $desc ([P])..." &
cd "$TMP" cd "$TMP"
{ /run/mido.sh "$url"; rc=$?; } || : { /run/mido.sh "$url"; rc=$?; } || :
cd /run cd /run
@ -486,7 +494,7 @@ downloadImage() {
fi fi
if [[ "$VERSION" != "win10x64" ]] && [[ "$VERSION" != "win11x64" ]]; then if [[ "$VERSION" != "win10x64" ]] && [[ "$VERSION" != "win11x64" ]]; then
error "Failed to download $desc" && return 1 return 1
fi fi
info "Failed to download $desc using Mido, will try a different method now..." info "Failed to download $desc using Mido, will try a different method now..."
@ -499,45 +507,45 @@ downloadImage() {
iso="$ISO" iso="$ISO"
rm -f "$iso" rm -f "$iso"
if ! getESD "$TMP/esd" "$iso"; then url=""
return 1 rc=99
if getESD "$TMP/esd" "$iso"; then
url="$ESD_URL"
fi fi
url="$ESD_URL" fi
if [ -n "$url" ]; then
msg="Downloading $desc..." msg="Downloading $desc..."
info "$msg" && html "$msg" info "$msg" && html "$msg"
/run/progress.sh "$iso" "Downloading $desc ([P])..." & /run/progress.sh "$iso" "Downloading $desc ([P])..." &
fi { wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || :
# Check if running with interactive TTY or redirected to docker log fKill "progress.sh"
if [ -t 1 ]; then
progress="--progress=bar:noscroll"
else
progress="--progress=dot:giga"
fi
{ wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || : if (( rc == 0 )) && [ -f "$iso" ]; then
if [ $(stat -c%s "$iso") -gt 100000000 ]; then
fKill "progress.sh" html "Download finished successfully..." && return 0
fi
if (( rc == 0 )) && [ -f "$iso" ]; then
if [ $(stat -c%s "$iso") -gt 100000000 ]; then
html "Download finished successfully..." && return 0
fi fi
fi fi
if [[ "$EXTERNAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then
case "${VERSION,,}" in case "${VERSION,,}" in
"win11${ARCHI,,}") "win11${ARCHI,,}")
url="https://dl.bobpony.com/windows/11/en-us_windows_11_23h2_x64.iso" url="https://dl.bobpony.com/windows/11/en-us_windows_11_23h2_${ARCHI}.iso"
;; ;;
"win10${ARCHI,,}") "win10${ARCHI,,}")
url="https://dl.bobpony.com/windows/10/en-us_windows_10_22h2_x64.iso" url="https://dl.bobpony.com/windows/10/en-us_windows_10_22h2_${ARCHI}.iso"
;; ;;
*) *)
error "Failed to download $url , reason: $rc" && return 1 (( rc != 99 )) && error "Failed to download $url , reason: $rc"
return 1
;; ;;
esac esac
@ -567,7 +575,8 @@ downloadImage() {
fi fi
error "Failed to download $url , reason: $rc" && return 1 (( rc != 99 )) && error "Failed to download $url , reason: $rc"
return 1
} }
extractESD() { extractESD() {