replace MIRRORLIST with PACMAN_MIRROR

This commit is contained in:
Tobias Powalowski 2023-09-06 10:28:59 +02:00
parent 054b7ac43c
commit b248d03f23
2 changed files with 5 additions and 6 deletions

View file

@ -24,13 +24,13 @@ _select_mirror() {
_DOWNLOAD="Downloading latest mirrorlist for Region ${_COUNTRY}..." _DOWNLOAD="Downloading latest mirrorlist for Region ${_COUNTRY}..."
_download_mirror | _dialog --title " Pacman Configuration " --no-mouse --gauge "${_DOWNLOAD}" 6 70 0 _download_mirror | _dialog --title " Pacman Configuration " --no-mouse --gauge "${_DOWNLOAD}" 6 70 0
if grep -q '#Server = https:' /tmp/pacman_mirrorlist.txt; then if grep -q '#Server = https:' /tmp/pacman_mirrorlist.txt; then
mv "${_MIRRORLIST}" "${_MIRRORLIST}.bak" mv "${_PACMAN_MIRROR}" "${_PACMAN_MIRROR}.bak"
cp /tmp/pacman_mirrorlist.txt "${_MIRRORLIST}" cp /tmp/pacman_mirrorlist.txt "${_PACMAN_MIRROR}"
fi fi
fi fi
# This regex doesn't honor commenting # This regex doesn't honor commenting
_MIRRORS=$(grep -E -o '(https)://[^/]*' "${_MIRRORLIST}" | sed 's|$| _|g') _MIRRORS=$(grep -E -o '(https)://[^/]*' "${_PACMAN_MIRROR}" | sed 's|$| _|g')
[[ -z ${_MIRRORS} ]] && _MIRRORS=$(grep -E -o '(http)://[^/]*' "${_MIRRORLIST}" | sed 's|$| _|g') [[ -z ${_MIRRORS} ]] && _MIRRORS=$(grep -E -o '(http)://[^/]*' "${_PACMAN_MIRROR}" | sed 's|$| _|g')
_SYNC_URL="" _SYNC_URL=""
while [[ -z "${_SYNC_URL}" ]]; do while [[ -z "${_SYNC_URL}" ]]; do
#shellcheck disable=SC2086 #shellcheck disable=SC2086
@ -47,7 +47,7 @@ _select_mirror() {
# our mirrorlist and pulling the full URL out. Substitute 'core' in # our mirrorlist and pulling the full URL out. Substitute 'core' in
# for the repository name, and ensure that if it was listed twice we # for the repository name, and ensure that if it was listed twice we
# only return one line for the mirror. # only return one line for the mirror.
_SYNC_URL=$(grep -E -o "${_SERVER}.*" "${_MIRRORLIST}" | head -n1) _SYNC_URL=$(grep -E -o "${_SERVER}.*" "${_PACMAN_MIRROR}" | head -n1)
fi fi
done done
echo "Using mirror: ${_SYNC_URL}" >"${_LOG}" echo "Using mirror: ${_SYNC_URL}" >"${_LOG}"

View file

@ -9,7 +9,6 @@ _NO_LOG="/dev/null"
_ANSWER="/.${_BASENAME}" _ANSWER="/.${_BASENAME}"
_LABEL="Exit" _LABEL="Exit"
_DLPROG="curl -L -s" _DLPROG="curl -L -s"
_MIRRORLIST="/etc/pacman.d/mirrorlist"
_KERNELPKG="linux" _KERNELPKG="linux"
_KEYRING="archlinux-keyring" _KEYRING="archlinux-keyring"
if echo "${_BASENAME}" | grep -qw aarch64; then if echo "${_BASENAME}" | grep -qw aarch64; then