]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - config/updxlrator/download
3 # This code is distributed under the terms of the GPL
7 # $Id: download,v 1.0 2006/08/30 00:00:00 marco.s Exp $
12 my $logfile="/var/log/updatexlrator/download.log";
14 my $updcachedir="/srv/web/ipfire/html/updatecache";
20 my $dsturl=@ARGV[0]; if ($dsturl eq '') { exit; }
22 $dsturl =~ s@\
%2f@
/@ig;
23 $updfile = substr($dsturl,rindex($dsturl,"/")+1);
25 # ---------------------------------------------------------------
27 # ---------------------------------------------------------------
31 &writelog
("Retrieving file for local cache: $updfile");
32 `/usr/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl >>$logfile 2>&1`;
35 `/usr/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl 2>&1`;
38 if ($debug) { &writelog
("Moving file into the cache directory -> \"$updcachedir/$updfile\""); }
39 system("mv $updcachedir/download/$updfile $updcachedir");
41 # ---------------------------------------------------------------
43 # ---------------------------------------------------------------
45 if ($debug) { &writelog
("Writing metadata \"$updcachedir/metadata/$updfile\""); }
47 open(FILE
,"$updcachedir/metadata/$updfile");
53 open(FILE
,">$updcachedir/metadata/$updfile");
54 foreach (@metadata) { print FILE
"$_\n"; }
58 # ===============================================================
62 open (LOGFILE
,">>$logfile");
63 my @now = localtime(time);
64 printf LOGFILE
"%02d:%02d:%02d %s\n",$now[2],$now[1],$now[0],$_[0];
68 # ===============================================================