#include hallo.h
A better version of that script attached.
Regards,
Eduard.
--
asuffield we should have a button on every computer marked ?, and
connected to twenty pounds of semtex, and then let evolution take its
course// quote from #debian-devel
#!/usr/bin/perl
use strict;
my ($cachedir, $baseurl, $verbose) = @ARGV;
die USAGE: apt-precache apt-cacher-cachedir apt-cacher-base-url [-v] \n if !
($cachedir $baseurl);
my $tmp=`mktemp`;
my $pcount=0;
chomp $tmp;
chdir $cachedir;
for my $pgz (*es.gz) {
my $acurl=$pgz;
$acurl =~ s!_!/!g;
my $pgzurl = $baseurl/$acurl;
$acurl =~ s!^!$baseurl/!;
$acurl =~ s!/dists/.*!!; # that sucks, pure guessing
print D: $pgzurl\n if $verbose;
# dl to temp file first, otherwise risking connection timout
if((!system wget,-q,-O,$tmp,$pgzurl) open(pfile,-|,zcat,$tmp)) {
my %pkgs;
for (*) { my $pn=$_; $pn=~s/_.*//g; $pkgs{$pn}=$_; }
while(pfile) {
if(/^Filename: (.*)\n/) {
my $path=$1;
/^Filename: .*\/(([^\/_]+).*)\n/;
if($pkgs{$2}) {
if(!-e $1) {
$pcount++;
print D: $acurl/$path\n if $verbose;
system wget, -q, -O, /dev/null, $acurl/$path;
}
}
}
}
}
}
unlink $tmp;
print Downloaded: $pcount packages.\n if $verbose;