2021-07-06 17:06:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Source mangle vars
|
2021-07-06 21:46:20 +00:00
|
|
|
# shellcheck source=./common disable=SC1091,1090
|
2021-07-06 21:34:26 +00:00
|
|
|
source "$(dirname "$0")/common"
|
2021-07-06 17:06:40 +00:00
|
|
|
# Source sync / migrate vars for repository information
|
2021-07-06 21:46:20 +00:00
|
|
|
# shellcheck source=../sync/common disable=SC1091,1090
|
2021-07-06 21:34:26 +00:00
|
|
|
source "$(dirname "$0")/../sync/common"
|
2021-07-06 17:06:40 +00:00
|
|
|
|
|
|
|
# How many
|
|
|
|
ARG1=${1}
|
|
|
|
NUM=$(( ${ARG1:-${MIRROR_DISPLAY_COUNT}} + 2))
|
|
|
|
|
|
|
|
print_result () {
|
|
|
|
if [[ "${result}" =~ "invalid repo or arch" ]]; then
|
2021-07-06 21:19:43 +00:00
|
|
|
printf "# repo = %s arch = %s\n" "${repo}" "${arch}"
|
2021-07-06 17:06:40 +00:00
|
|
|
printf "# FAIL: invalid repo or arch\n\n"
|
|
|
|
else
|
|
|
|
printf "%s\n# number of mirrors returned: %s\n\n" "$( echo "$result" | head -${NUM})" "$(( $(echo "$result" | wc -l) - 2 ))"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup_repo () {
|
|
|
|
# plus is actually 'rockyplus'. Others may as well(?)
|
|
|
|
if [[ "${repo}" =~ ^(plus)$ ]]; then
|
|
|
|
repo="rocky${repo}"
|
2021-07-06 19:26:02 +00:00
|
|
|
|
|
|
|
# nfv is actually 'NFV'
|
2021-07-06 17:06:40 +00:00
|
|
|
elif [[ "${repo}" =~ ^(nfv)$ ]]; then
|
|
|
|
repo="${repo^^}"
|
|
|
|
fi
|
2021-07-06 19:26:02 +00:00
|
|
|
|
|
|
|
# Everything has an 8 appended to it
|
|
|
|
repo="${repo}-8"
|
2021-07-06 17:06:40 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
for repo in "${ALL_REPOS[@]}"; do
|
|
|
|
|
|
|
|
# Business logic must be done, sometimes...
|
|
|
|
cleanup_repo "${repo}"
|
|
|
|
|
|
|
|
# Print a nice header
|
2021-07-06 21:19:43 +00:00
|
|
|
printf "================\n%s\n================\n" "${repo}"
|
2021-07-06 17:06:40 +00:00
|
|
|
for arch in "${ARCHES[@]}" "source"; do
|
2021-07-06 19:26:02 +00:00
|
|
|
# Source is treated as its own architecture
|
2021-07-06 17:06:40 +00:00
|
|
|
if [[ "${arch}" == "source" ]]; then
|
2021-07-06 19:26:02 +00:00
|
|
|
repo="${repo}-source"
|
2021-07-06 17:06:40 +00:00
|
|
|
fi
|
|
|
|
|
2021-07-06 19:26:02 +00:00
|
|
|
# Get the normal repo/arch combinations
|
|
|
|
result=$(curl -s "${MIRRORLIST_BASE}?repo=${repo}&arch=${arch}&time&country=global")
|
2021-07-06 17:06:40 +00:00
|
|
|
print_result
|
|
|
|
|
2021-07-06 19:26:02 +00:00
|
|
|
# x86 and a64 have 'debug' types, as well
|
2021-07-06 17:06:40 +00:00
|
|
|
if [[ "${arch}" =~ ^(x86_|aarch)64$ ]]; then
|
2021-07-06 19:26:02 +00:00
|
|
|
result=$(curl -s "${MIRRORLIST_BASE}?repo=${repo}-debug&arch=${arch}&time&country=global")
|
2021-07-06 17:06:40 +00:00
|
|
|
print_result
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
done
|