Skip to content

Instantly share code, notes, and snippets.

@mjs
Created August 12, 2016 05:25
Show Gist options
  • Save mjs/90ac9f9d3dde4f511f02c0c4cbc4da00 to your computer and use it in GitHub Desktop.
Save mjs/90ac9f9d3dde4f511f02c0c4cbc4da00 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
$mirror = "nz.archive.ubuntu.com";
#$mirror = "us.archive.ubuntu.com";
# For Cape Town
#$mirror = "ubuntu.saix.net/ubuntu-archive";
$| = 1;
while (<>) {
@line = split;
$_ = $line[0];
if (m/^http:\/\/((?:[a-z0-9]+\.)?archive\.ubuntu\.com)\/(.*)/ &&
$1 ne $mirror) {
print "http://" . $mirror . "/" . $2 . "\n";
} else {
print $_ . "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment