Created
September 27, 2018 10:30
-
-
Save editicalu/a90ce4c7b06c6cfbb6853c2e1bc872e5 to your computer and use it in GitHub Desktop.
Pacman mirror update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /tmp | |
echo "Creating a backup of the old mirrorlist in /etc/pacman.d/mirrorlist.backup…" | |
su -c "rm /etc/pacman.d/mirrorlist.pacnew && cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup && sync" | |
echo "Downloading a new mirrorlist…" | |
# Change this line to your preferences | |
# Standard: only servers with HTTPS and IPv6 support. | |
curl https://www.archlinux.org/mirrorlist/\?country\=all\&protocol\=https\&ip_version\=6 > mirrorlist.new | |
# Add unofficial mirrors if you want to. | |
#echo "Adding the faster unofficial TransIP mirror" | |
#echo '' >> mirrorlist.new | |
#echo 'Server = https://mirror.transip.net/archlinux/$repo/os/$arch' >> mirrorlist.new | |
echo "Preparing the new mirrorlist…" | |
sed "s/#Server/Server/" mirrorlist.new > mirrorlist | |
mv mirrorlist mirrorlist.new | |
echo "Testing the mirrors. This may take a while. Go make yourself a cup of coffee. ☕" | |
rankmirrors mirrorlist.new > mirrorlist | |
echo "Replacing the old mirrorlist" | |
su -c "mv mirrorlist /etc/pacman.d/mirrorlist" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment