You are not logged in.
Pages: 1
I needed a script to find the nearest mirror and put it at the top of mirrorlist, because I often go from France to Ireland !
So here it is, it needs ruby and netselect...
(and I just can't understand there isn't something like that by default with pacman, or at least with the netselect package !)
#!/usr/bin/env ruby
#
# Using netselect to find the best mirror from /etc/pacman.d/mirrorlist and put it at the top
#
file = File.readlines('/etc/pacman.d/mirrorlist')
mirrors = file.map{ |line|
if not line =~ /^#/ then
line[/^Server = (.*)$/, 1]
end
}.compact.join(" ")
puts "Testing all the mirrors, can take a while..."
res = `netselect #{mirrors}`[/\s*\d*\s*(.*)$/, 1]
puts "And the winner is :"
puts line = "Server = "+res.sub('//os', '/$repo/os')
if file[0] =~ /netselect-pacman/ then
file[1] = line+"\n"
else
file.insert 0, "# Server choosen by netselect-pacman. Just comment out if you don't like !\n", line+"\n", "\n"
end
File.new('/etc/pacman.d/mirrorlist', 'w').write file.join
Hope it will be useful for someone !
Offline
I just can't understand there isn't something like that by default with pacman
/usr/bin/rankmirrors is owned by pacman
Run it with no arguments to get the available options. It's in python, btw.
Offline
Oh, cool, I didn't knew it...
But I don't like it too much, because I just want to use the best server available !
And to update my mirrorlist in one command, without messing all the comments.
And since I don't know python, I can't tweak it for doing that...
So I'll stick on using my netselect script ! ;-)
Perhaps we could add it to the netselect package, since there is netselect-apt in it !!
Offline
Pages: 1