lkml.org 
[lkml]   [1999]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: latest-only kernel.org mirrors
On Fri, 8 Jan 1999, Riley Williams wrote:

# Actually, I could create such a mirror quite easily: All it needs is
# for the mirror site to run a script that:
#
# 1. Deletes all except the latest file in each tree.
#
# 2. Mirrors any files created in the last week.
#

I use the following script to mirror only the latest stuff ....

#!/bin/perl

$|=1;
#$src="ftp://ftp.kernel.org/pub/linux/kernel";
$src="ftp://katelyn.optilinkcomm.net/pub/linux/kernel";
$dst="/usr/src/kernels";

$patch=0;

$patch=1 if $ARGV[0] eq "-p";

sub makefn {
my $ver=shift;
my $maj;

$maj=$1 if $ver=~/^(\d+\.\d+)/;

if ($maj eq "2.2") {
$maj="2.1";
}

if ($patch) {
return "v$maj/patch-$ver.bz2";
} else {
return "v$maj/linux-$ver.tar.bz2";
}
}
sub makemaj {
my $ver=shift;
my $maj;

$maj=$1 if $ver=~/^(\d+\.\d+)/;

return $maj;
}


sub get {
my $ver=shift;
my $rem=makefn($ver);

my $fn;

if ($patch) {
$fn="$dst/patch-$ver.bz2";
}
else {
$fn="$dst/linux-$ver.tar.bz2";
}


my $maj=makemaj($ver);
my @ls;

if ( -f $fn ) {
print "Checking $ver...\n";
}
else {
if ($patch) {
@ls=<$dst/patch-$maj*.bz2>;
} else {
@ls=<$dst/linux-$maj*.tar.bz2>;
}
print "Getting $src/$rem...\n";
}

system("cd $dst;wget -c -m -t 10 -nd $src/$rem") || do {
if (defined @ls) {
unlink @ls;
}
};

}


open(FINGER,'finger @ftp.kernel.org|') || die;
while (<FINGER>) {
$stable=$1 if /latest stable.+:\s+(.+)/;
$beta=$1 if /latest beta.+:\s+(.+)/;
$alpha=$1 if /latest prepatch.+:\s+(.+)/;
}
close FINGER;

get $stable;
get $beta;
get $alpha;

--------------

I've been meaning to rewrite this for a while (as far as I'm concerned it
sucks ass for a perl script of mine), but haven't had the time ;) But it
works.


G'day!
-- n i c h o l a s j l e o n
elegance through simplicity*http://mrnick.binary9.net*nicholas@binary9.net
good fortune through truth*roaming:njllm@email.msn.com*ICQ#2170994*U+($++)
TRA#6805*not all questions have answers*pseudogeek:P+++($++)L+($++)W=lm@b9


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.078 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site