Skip to content

Instantly share code, notes, and snippets.

@MarkusH
Created September 1, 2014 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkusH/5ab40718759c988fba1a to your computer and use it in GitHub Desktop.
Save MarkusH/5ab40718759c988fba1a to your computer and use it in GitHub Desktop.
Update pacman mirrorlist
#!/bin/sh
COUNTRY=DE
PROTOCOL=('http' 'https')
IP=(4 6)
if [ $UID != 0 ] ; then
echo "run as root"
exit 1
fi
URL="https://www.archlinux.org/mirrorlist/?country=${COUNTRY}"
for p in ${PROTOCOL[@]} ; do
URL="${URL}&protocol=${p}"
done
for i in ${IP[@]} ; do
URL="${URL}&ip_version=${i}"
done
echo -e "Receiving mirrors from\n${URL}"
curl -s "${URL}" | sed 's/^#Server/Server/' | rankmirrors -n 6 - | tee /etc/pacman.d/mirrorlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment