]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - config/updxlrator/download
cc187f5e8d512faf761870c89a4a72a579e7ca8d
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 $apphome="/var/ipfire/updatexlrator";
13 my $logfile="/var/log/updatexlrator/download.log";
14 my $debug=(-e
"$apphome/debug");
15 my $updcachedir="/srv/web/ipfire/html/updatecache";
21 my $dsturl=@ARGV[0]; if ($dsturl eq '') { exit; }
23 $dsturl =~ s@\
%2f@
/@ig;
24 $updfile = substr($dsturl,rindex($dsturl,"/")+1);
26 # ---------------------------------------------------------------
28 # ---------------------------------------------------------------
32 &writelog
("Retrieving file for local cache: $updfile");
33 `$apphome/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl >>$logfile 2>&1`;
36 `$apphome/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl 2>&1`;
39 if ($debug) { &writelog
("Moving file into the cache directory -> \"$updcachedir/$updfile\""); }
40 system("mv $updcachedir/download/$updfile $updcachedir");
42 # ---------------------------------------------------------------
44 # ---------------------------------------------------------------
46 if ($debug) { &writelog
("Writing metadata \"$updcachedir/metadata/$updfile\""); }
48 open(FILE
,"$updcachedir/metadata/$updfile");
54 open(FILE
,">$updcachedir/metadata/$updfile");
55 foreach (@metadata) { print FILE
"$_\n"; }
59 # ===============================================================
63 open (LOGFILE
,">>$logfile");
64 my @now = localtime(time);
65 printf LOGFILE
"%02d:%02d:%02d %s\n",$now[2],$now[1],$now[0],$_[0];
69 # ===============================================================