mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
add GeoIP mirrorlist on latest image
This commit is contained in:
parent
df6fe865d1
commit
e2e4114299
2 changed files with 18 additions and 0 deletions
|
@ -47,6 +47,7 @@ fi
|
|||
# Generate new environment and launch it with kexec
|
||||
if [[ -n "${_L_COMPLETE}" || -n "${_L_INSTALL_COMPLETE}" ]] && [[ -z "${_G_RELEASE}" ]]; then
|
||||
_update_installer_check
|
||||
_geoip_mirrorlist
|
||||
: > /.update
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | New Environment"
|
||||
_new_environment | _dialog --title "${_MENU_TITLE}" --gauge "Waiting for pacman keyring..." 6 75 0
|
||||
|
|
|
@ -75,6 +75,23 @@ _update_installer_check() {
|
|||
fi
|
||||
}
|
||||
|
||||
# download geoip mirrorlist for x86_64
|
||||
_geoip_mirrorlist() {
|
||||
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
|
||||
_COUNTRY="$(${_DLPROG} "http://ip-api.com/csv/?fields=countryCode")"
|
||||
echo "GeoIP country ${_COUNTRY} detected." >>"${_LOG}"
|
||||
${_DLPROG} -o /tmp/pacman_mirrorlist.txt "https://www.archlinux.org/mirrorlist/?country=${_COUNTRY}&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on"
|
||||
sed -i -e 's|^#Server|Server|g' /tmp/pacman_mirrorlist.txt
|
||||
if grep -q 'Server = https:' /tmp/pacman_mirrorlist.txt; then
|
||||
mv "${_PACMAN_MIRROR}" "${_PACMAN_MIRROR}.bak"
|
||||
cp /tmp/pacman_mirrorlist.txt "${_PACMAN_MIRROR}"
|
||||
echo "GeoIP activated successfully." >>"${_LOG}"
|
||||
else
|
||||
echo "GeoIP setting failed. Using fallback mirror." >>"${_LOG}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_full_system_check() {
|
||||
if [[ -e "/.full_system" ]]; then
|
||||
clear
|
||||
|
|
Loading…
Reference in a new issue