1
0
mirror of https://github.com/dockur/windows.git synced 2026-07-27 21:42:36 +07:00

fix: Remove internal download test (#1949)

This commit is contained in:
Kroese
2026-07-24 18:57:30 +02:00
committed by GitHub
parent b721ba2320
commit b692649a4f
2 changed files with 0 additions and 227 deletions
-2
View File
@@ -1192,8 +1192,6 @@ bootWindows() {
! parseLanguage && exit 56
! detectCustom && exit 59
testImages
if ! startInstall; then
bootWindows && return 0
exit 68
-225
View File
@@ -1009,231 +1009,6 @@ fallbackEnglish() {
downloadImage "$iso" "$version" "$LANGUAGE"
}
testDownload() {
local file="$1"
local url="$2"
local sum="$3"
local size="$4"
local desc="$5"
local web_desc="$6"
local total failed=""
if ! rm -f -- "$file" "$file.aria2"; then
error "Failed to remove previous test download: $file"
return 1
fi
# Call downloadFile() directly so downloadRetry(), delays and retries
# from the normal installation path are not used.
if ! downloadFile \
"$file" \
"$url" \
"$size" \
"$desc" \
"$web_desc" \
"${CONNECTIONS:-1}"; then
failed="Y"
elif ! total=$(stat -c%s -- "$file" 2>/dev/null); then
error "Failed to determine downloaded file size: $file"
failed="Y"
else
if [ -n "$size" ] && [[ "$size" != "0" && "$total" != "$size" ]]; then
error "The downloaded file has a different size ( $total bytes) than expected ( $size bytes)."
failed="Y"
fi
# Size was checked strictly above. Passing an empty expected size avoids
# the normal warning-only size handling while still verifying the hash.
if ! verifyFile "$file" "" "$total" "$sum"; then
failed="Y"
fi
fi
if ! rm -f -- "$file" "$file.aria2"; then
error "Failed to remove test download: $file"
failed="Y"
fi
[ -z "$failed" ]
}
downloadTest() {
local version="$1"
local lang="$2"
local normal="$version"
local dir="$STORAGE/tmp/download-test"
local file="$dir/test.iso"
local tested=0 failed=0
local url sum size base desc web_desc language i
# Dynamically scoped, so verifyFile() validates every available checksum.
local VERIFY="Y"
if ! rm -rf -- "$dir" || ! makeDir "$dir"; then
error "Failed to create download test directory: $dir"
return 1
fi
if [[ "${version,,}" == "http"* ]]; then
base=$(basename "${version%%\?*}")
desc=$(fromFile "$base")
web_desc="$desc"
tested=$((tested + 1))
info "Testing custom download..."
if ! testDownload "$file" "$version" "" "" "$desc" "$web_desc"; then
failed=$((failed + 1))
fi
else
if ! validVersion "$version" "en"; then
error "Invalid VERSION specified, value \"$version\" is not recognized!"
rm -rf -- "$dir" 2>/dev/null || true
return 1
fi
desc=$(printVariant "$version" "" "Y")
web_desc=$(printVariant "$version" "")
if [[ "${lang,,}" != "en" && "${lang,,}" != "en-"* ]]; then
language=$(getLanguage "$lang" "desc")
desc+=" in $language"
web_desc+=" in $language"
fi
if isMido "$version" "$lang"; then
tested=$((tested + 1))
MIDO_URL=""
info "Testing MIDO download..."
if ! getWindows "$version" "$lang" "$desc" "$web_desc" ||
[ -z "$MIDO_URL" ]; then
failed=$((failed + 1))
else
url=$(getMido "$version" "$lang" "")
sum=""
size=""
# Skip static verification if Microsoft returned a different URL.
if [[ "${MIDO_URL%%\?*}" == "${url%%\?*}" ]]; then
size=$(getMido "$version" "$lang" "size")
sum=$(getMido "$version" "$lang" "sum")
fi
if ! testDownload \
"$file" \
"$MIDO_URL" \
"$sum" \
"$size" \
"$desc" \
"$web_desc"; then
failed=$((failed + 1))
fi
fi
fi
# Evaluation media only exists through MIDO. ESD and mirrors use the
# corresponding normal version.
[[ "${normal,,}" == *"-eval" ]] && normal="${normal::-5}"
desc=$(printVariant "$normal" "" "Y")
web_desc=$(printVariant "$normal" "")
if [[ "${lang,,}" != "en" && "${lang,,}" != "en-"* ]]; then
desc+=" in $language"
web_desc+=" in $language"
fi
if isESD "$normal" "$lang"; then
tested=$((tested + 1))
ESD=""
info "Testing ESD download..."
if ! getESD "$dir/esd" "$normal" "$lang" "$desc"; then
failed=$((failed + 1))
elif ! testDownload \
"$dir/test.esd" \
"$ESD" \
"$ESD_SUM" \
"$ESD_SIZE" \
"$desc" \
"$web_desc"; then
failed=$((failed + 1))
fi
fi
for ((i=1;i<=MIRRORS;i++)); do
url=$(getLink "$i" "$normal" "$lang")
[ -z "$url" ] && continue
tested=$((tested + 1))
size=$(getSize "$i" "$normal" "$lang")
sum=$(getHash "$i" "$normal" "$lang")
info "Testing download mirror $i: $(getHost "$url")..."
if ! testDownload \
"$file" \
"$url" \
"$sum" \
"$size" \
"$desc" \
"$web_desc"; then
failed=$((failed + 1))
fi
done
fi
if ! rm -rf -- "$dir"; then
error "Failed to remove download test directory: $dir"
failed=$((failed + 1))
fi
if (( tested == 0 )); then
error "No download methods are available for $version."
return 1
fi
if (( failed > 0 )); then
error "$failed of $tested download methods failed."
return 1
fi
info "All $tested download methods completed successfully."
return 0
}
testImages() {
disabled "${TEST:-}" && return 0
if downloadTest "$VERSION" "$LANGUAGE"; then
info "Download test completed successfully."
exit 0
fi
error "Download test failed."
exit 61
}
downloadImage() {
local iso="$1"