Skip to content

Commit

Permalink
Support multiple mirrors in fetch_stage3_archive_name() #250
Browse files Browse the repository at this point in the history
  • Loading branch information
edannenberg committed Feb 13, 2024
1 parent 018b055 commit 3aa97bb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,20 @@ function get_stage3_archive_regex() {
function fetch_stage3_archive_name() {
__fetch_stage3_archive_name=
ARCH="${ARCH:-amd64}"
ARCH_URL="${ARCH_URL:-${MIRROR}releases/${ARCH}/autobuilds/current-${STAGE3_BASE}/}"
local mirrors_split mirror stage3_url stage3_path
if [ -z "${ARCH_URL}" ]; then
stage3_path="/releases/${ARCH}/autobuilds/current-${STAGE3_BASE}/"
read -ra mirrors_split <<<"${MIRROR}"
for mirror in "${mirrors_split[@]}"; do
stage3_url="${mirror}${stage3_path}"
if wget --spider "${stage3_url}" 2>/dev/null; then
ARCH_URL="${stage3_url}"
break;
fi
done
fi
[[ -z "${ARCH_URL}" ]] && die "Could not find stage3 location on mirror(s): ${MIRROR} with url path: ${stage3_path}"

local remote_files remote_line remote_date remote_file_type max_cap
readarray -t remote_files <<< "$(wget -qO- "${ARCH_URL}")"
remote_date=0
Expand Down

0 comments on commit 3aa97bb

Please sign in to comment.