Hello there.
So now I've read many blogs out there. And I think it's time that I also own some blogs about what I'm doing with my spare time and whatnot :P So I came across blogger.com and thought it would be a good idea to get my hands dirty and create one. So here we are.
First of all I want to tell you that pacman.d mirrorlist is sometimes really not ordered all that well :P So after waiting another round of minute for the VLC package to download completely, I figured it would be the best to just sit down and write this script:
tmpf=$(mktemp) trap "rm -f $tmpf; exit" INT TERM gawk ' /#?Server =/ { host = gensub(/^[^:]+:\/\/([^/]+).*/, "\\1", 1, $3) print host, $0 }' /etc/pacman.d/mirrorlist | while read host line; do echo "trying to ping '$host'" >/dev/stderr timed=$(ping -i 0.3 -c 1 -W 1 -n -q $host 2>/dev/null | tail -n1 | gawk '{ print $4 }' | cut -f2 -d/) [ x != x$timed ] && echo $timed ${line%#*}; done | LC_ALL=C sort -n | while read crap remains; do echo $remains \# $crap ms; done > $tmpf echo 'the following was created: ' cat $tmpf echo -e '\nwant me to use it? (y|n)' read reply if [ x$reply = xy ]; then mv $tmpf /etc/pacman.d/mirrorlist else rm -f $tmpf fi
What does it do? Well, it basicially finds out the currently best order for the mirrorlist file, so that the fastest mirror is at the top. After running it, I was really impressed about the speed of pacman. It rushed through like a tiger :P
5 comments:
Hi,
I would like to be C++ expert like you. Please suggest some good books and other resources.
Thanks,
Your Friend,
David (david.makcenzie@gmail.com)
wow sweet blog dude. try updating it.
Please Help:
http://stackoverflow.com/questions/2148477/multiple-content-div-loading-with-ajax-json
Best regards
Being an active participant in Stack overflow, I expected you have an up-to-date blog world. :)
There exist several scripts to automatically determine the best mirrors. However I found that today it is sufficient to just use the website service:
https://www.archlinux.org/mirrorlist/
What really does boost download speed, however, is parallel downloading from several mirrors at once. And it is easy, too!
I use this solution:
https://wiki.archlinux.org/index.php/Improve_Pacman_Performance#pacget_.28aria2.29_Mirror_Script
Have fun with pacman!
Post a Comment