Fix some issues with baseurl checks and overrides.

This commit is contained in:
Peter Ajamian 2022-02-26 19:44:31 +13:00
parent f3fe6d768a
commit d5a6e46df3
1 changed files with 11 additions and 3 deletions

View File

@ -44,6 +44,8 @@ if (( BASH_VERSINFO[0]*100 + BASH_VERSINFO[1] < 402 )); then
exit 1
fi
shopt -s extglob
# Make sure we're root.
if (( EUID != 0 )); then
printf '%s\n' \
@ -436,6 +438,7 @@ _repoinfo () {
# We now store the repoinfo results in a cache.
declare -g -A repoinfo_results_cache=()
repoinfo () {
local k
if [[ ! ${repoinfo_results_cache[$1]} ]]; then
_repoinfo "$@" || return
repoinfo_results_cache[$1]=1
@ -512,9 +515,13 @@ check_repourl () {
return 1
fi
curl -sfLI "${repoinfo_results[Repo-baseurl]%% *}repodata/repomd.xml" \
> /dev/null
return
local -a urls;
IFS=, read -r -a urls <<<"${repoinfo_results[Repo-baseurl]}"
local u
for u in "${urls[@]##*( )}"; do
curl -sfLI "${u%% *}repodata/repomd.xml" > /dev/null && return
done
return "$(( $? ? $? : 1 ))"
}
collect_system_info () {
@ -639,6 +646,7 @@ collect_system_info () {
# ...and finally set a number of dnf options to replace the baseurl of these
# repos
local k
for k in "${!dist_repourl_map[@]}"; do
local d=${k%%:*} r=${k#*:}
if [[ $d != "$dist_id" || ! ${enabled_repo_check[$r]} ]] ||