Skip to content

Instantly share code, notes, and snippets.

@u8sand
Created January 20, 2017 03:34
Show Gist options
  • Save u8sand/de1c13a66e1ab65a18777dbe4621c973 to your computer and use it in GitHub Desktop.
Save u8sand/de1c13a66e1ab65a18777dbe4621c973 to your computer and use it in GitHub Desktop.
Script for ranking the mirrorlist.pacnew files that are updated every once in a while.
#!/bin/bash
if [ $(id -u) != 0 ]; then
exec sudo -- "$0" "$@"
else
cat /etc/pacman.d/mirrorlist.pacnew | awk -v RS='\n\n' '/^## United States/{print $0}' | awk '/^#Server/{print substr($0, 2)}' | rankmirrors - > /etc/pacman.d/mirrorlist
rm /etc/pacman.d/mirrorlist.pacnew
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment