Regenerate mirrorlist with reflector

If reflector is not avaiable on the host system, let's regenerate the mirrorlist by using reflector from the chroot.
This commit is contained in:
Kron4ek 2023-08-11 13:59:50 +05:00 committed by GitHub
parent 72b7dd36d2
commit 22abd340b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -252,7 +252,9 @@ mount_chroot
generate_localegen
if command -v reflector 1>/dev/null; then
reflector --protocol https --score 5 --sort rate --save mirrorlist
echo "Generating mirrorlist..."
reflector --connection-timeout 10 --download-timeout 10 --protocol https --score 7 --sort rate --save mirrorlist
reflector_used=1
else
generate_mirrorlist
fi
@ -299,6 +301,12 @@ date -u +"%d-%m-%Y %H:%M (DMY UTC)" > "${bootstrap}"/version
# These packages are required for the self-update feature to work properly
run_in_chroot pacman --noconfirm --needed -S base reflector squashfs-tools fakeroot
# Regenerate the mirrorlist with reflector if reflector was not used before
if [ -z "${reflector_used}" ]; then
echo "Generating mirrorlist..."
run_in_chroot reflector --connection-timeout 10 --download-timeout 10 --protocol https --score 7 --sort rate --save /etc/pacman.d/mirrorlist
fi
export -f install_packages
run_in_chroot bash -c install_packages