Created
September 1, 2014 07:17
-
-
Save MarkusH/5ab40718759c988fba1a 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/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