To follow up on the mirror idea...

Here's a quick draft for a CGI that would accept HTTP (haven't tried FTP
URLs yet) requests for pkgsrc packages and direct them to a random mirror,
pasted below.  In testing, pkg_add works with it, either as a directly
passed URL or if you set PKG_PATH.  BINPKG_SITES does not work for 'bmake
bin-install' targets, because it unhelpfully assumes it needs to add /All
onto the target URL.

#!/usr/pkg/bin/perl

@mirrors = (
"http://www.pkgsrc-box.org/packages/stable/DragonFly-1.10/All";,
"http://chlamydia.fs.ei.tum.de/pub/DragonFly/packages/stable/DragonFly-1.10/All";,
     
"http://www.theshell.com/pub/DragonFly/packages/stable/DragonFly-1.10/All";,
      
"http://ftp.twaren.net/BSD/DragonFlyBSD/packages/stable/DragonFly-1.10/All";,
);

my $target = $ENV{'REQUEST_URI'};
$target =~ s/^\/download//;

print "Location: " . $mirrors[int(rand(scalar(@mirrors)))] . "$target\n\n";


Reply via email to