Skip to content

Commit b1b36dc

Browse files
Marketenclaude
andcommitted
Make base ISO downloads survive mirror moves and dead mirror hosts
Debian only moves a point release into cdimage/archive once it has been superseded, so the archive URL 404s for the current release. That broke every automated base ISO bump (e.g. #727, debian-13.7.0). Try debian-cd first and fall back to the archive. Download with curl instead of busybox wget. cdimage.debian.org resolves to two addresses and one of them is currently unreachable; wget gives up on it while curl moves on to the next one. Partial downloads are removed so a failed attempt is not reused by the next build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 289a8cd commit b1b36dc

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

‎iso/scripts/common_iso_generation.sh‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,34 @@ WORKDIR="/usr/src/app"
44
ISO_BUILD_PATH="${WORKDIR}/dappnode-iso"
55
DAPPNODE_ISO_PREFIX="Dappnode-"
66

7+
# Usage: download_iso <path> <name> <url> [fallback_url...]
8+
# URLs are tried in order, which covers mirrors that move older releases elsewhere.
79
download_iso() {
810
local iso_path=$1
911
local iso_name=$2
10-
local iso_url=$3
12+
shift 2
1113

1214
echo "[INFO] Downloading base ISO image: ${iso_name}..."
13-
if [ ! -f "${iso_path}" ]; then
14-
wget "${iso_url}" -O "${iso_path}"
15+
if [ -f "${iso_path}" ]; then
16+
echo "[INFO] Download complete!"
17+
return 0
1518
fi
16-
echo "[INFO] Download complete!"
19+
20+
local iso_url
21+
for iso_url in "$@"; do
22+
# Unlike busybox wget, curl moves on to the next address when a mirror
23+
# host resolves to several and one of them is down.
24+
if curl -fsSL --retry 3 --retry-connrefused --connect-timeout 30 -o "${iso_path}" "${iso_url}"; then
25+
echo "[INFO] Download complete!"
26+
return 0
27+
fi
28+
# A failed download leaves a partial file behind, which would be reused on the next run
29+
rm -f "${iso_path}"
30+
echo "[WARN] Could not download ${iso_url}"
31+
done
32+
33+
echo "[ERROR] Could not download ${iso_name} from any known location"
34+
exit 1
1735
}
1836

1937
verify_download() {

‎iso/scripts/generate_dappnode_iso_debian.sh‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ BASE_ISO_NAME="debian-13.5.0-amd64-netinst.iso"
99
BASE_ISO_VERSION="${BASE_ISO_NAME#debian-}"
1010
BASE_ISO_VERSION="${BASE_ISO_VERSION%-amd64-netinst.iso}"
1111
BASE_ISO_PATH="/images/${BASE_ISO_NAME}"
12-
BASE_ISO_URL="https://cdimage.debian.org/mirror/cdimage/archive/${BASE_ISO_VERSION}/amd64/iso-cd/${BASE_ISO_NAME}"
12+
# Debian serves the newest point release from debian-cd/ and only moves it to the
13+
# archive once it is superseded, so try both.
14+
BASE_ISO_URL="https://cdimage.debian.org/debian-cd/${BASE_ISO_VERSION}/amd64/iso-cd/${BASE_ISO_NAME}"
15+
BASE_ISO_ARCHIVE_URL="https://cdimage.debian.org/mirror/cdimage/archive/${BASE_ISO_VERSION}/amd64/iso-cd/${BASE_ISO_NAME}"
1316
BASE_ISO_SHASUM="95838884f5ea6c82421dfe6baaa5a639dbbe6756c1e380f9fe7a7cb0c1949d2a ${BASE_ISO_PATH}"
1417

1518
DAPPNODE_ISO_NAME="${DAPPNODE_ISO_PREFIX}${BASE_ISO_NAME}"
@@ -87,7 +90,7 @@ generate_debian_iso() {
8790
-isohybrid-gpt-basdat -o "${iso_output_path}" ${iso_build_path}
8891
}
8992

90-
download_iso "${BASE_ISO_PATH}" "${BASE_ISO_NAME}" "${BASE_ISO_URL}"
93+
download_iso "${BASE_ISO_PATH}" "${BASE_ISO_NAME}" "${BASE_ISO_URL}" "${BASE_ISO_ARCHIVE_URL}"
9194
verify_download "${BASE_ISO_PATH}" "${BASE_ISO_SHASUM}"
9295
clean_old_files "${ISO_BUILD_PATH}" "${DAPPNODE_ISO_PREFIX}"
9396
extract_iso "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}"

0 commit comments

Comments
 (0)