mirror CGI test

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <kernel@...>
Date: Saturday, September 22, 2007 - 12:01 am

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";
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [Fwd: pkgsrc DragonFly 1.10.1/i386 2007-09-12 00:59], Matthew Dillon, (Thu Sep 20, 7:44 pm)
Re: [Fwd: pkgsrc DragonFly 1.10.1/i386 2007-09-12 00:59], Simon 'corecode' Schubert..., (Thu Sep 20, 8:33 pm)
Re: [Fwd: pkgsrc DragonFly 1.10.1/i386 2007-09-12 00:59], Justin C. Sherrill, (Thu Sep 20, 9:22 pm)
Re: [Fwd: pkgsrc DragonFly 1.10.1/i386 2007-09-12 00:59], Simon 'corecode' Schubert..., (Thu Sep 20, 9:18 pm)
mirror CGI test, Justin C. Sherrill, (Sat Sep 22, 12:01 am)
Re: [Fwd: pkgsrc DragonFly 1.10.1/i386 2007-09-12 00:59], Justin C. Sherrill, (Thu Sep 20, 9:14 pm)