Last active
January 20, 2020 21:26
-
-
Save 1094/75ca228aa66d1f058d855ea5da4b257f to your computer and use it in GitHub Desktop.
update pacman mirrorlist
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 | |
set -e | |
# update pacman mirrorlist, US, ip 4, status on | |
# get the mirrors | |
wget -O ~/newmirrors "https://www.archlinux.org/mirrorlist/?country=US&protocol=http&protocol=https&ip_version=4&use_mirror_status=on" | |
list=~/newmirrors | |
# uncomment mirrors | |
vim -c "%s/\#S/S" $list +wqall | |
# rank and save the mirrors | |
sudo -s <<EOF | |
echo 'ranking mirrors...' | |
rankmirrors -n 10 -v $list > /etc/pacman.d/mirrorlist | |
echo 'refreshing keys' | |
pacman-key --refresh | |
echo 'syncing the databases' | |
pacman -Syy | |
EOF | |
# delete the list | |
rm $list | |
echo 'mirrorlist removed, update complete.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment