Skip to content

Instantly share code, notes, and snippets.

@1094
Last active January 20, 2020 21:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1094/75ca228aa66d1f058d855ea5da4b257f to your computer and use it in GitHub Desktop.
Save 1094/75ca228aa66d1f058d855ea5da4b257f to your computer and use it in GitHub Desktop.
update pacman mirrorlist
#!/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