mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
Updated updxlrator to latest stable
This commit is contained in:
215
config/updxlrator/checkdeaddl
Normal file
215
config/updxlrator/checkdeaddl
Normal file
@@ -0,0 +1,215 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) 2006-2008 marco.s - http://update-accelerator.advproxy.net
|
||||
#
|
||||
# Portions (c) 2008 by dotzball - http://www.blockouttraffic.de
|
||||
#
|
||||
# $Id: checkdeaddl,v 1.1 2008/11/29 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
use Fcntl ':flock'; # import LOCK_* constants
|
||||
use HTTP::Date;
|
||||
|
||||
require '/var/ipfire/updatexlrator/updxlrator-lib.pl';
|
||||
|
||||
my $repository='/var/updatecache';
|
||||
my $logfile="/var/log/updatexlrator/download.log";
|
||||
my $logging=0;
|
||||
my $debug=0;
|
||||
my %proxysettings=();
|
||||
my %xlratorsettings=();
|
||||
my $updatefile='';
|
||||
my @downloads=();
|
||||
my $passive_mode=0;
|
||||
my $maxusage=0;
|
||||
my $nice='';
|
||||
my $lockfile = "/var/log/updatexlrator/checkdeaddl.lck";
|
||||
|
||||
&debuglog("Check if there is a lock ");
|
||||
open SEM, ">$lockfile" or die "Can't write-open $lockfile: $!";
|
||||
flock SEM, LOCK_EX;
|
||||
&debuglog("No lock, proceed ");
|
||||
|
||||
&writelog("Check for dead downloads ");
|
||||
|
||||
if (-e "${UPDXLT::apphome}/settings")
|
||||
{
|
||||
&UPDXLT::readhash("${UPDXLT::apphome}/settings", \%xlratorsettings);
|
||||
if ($xlratorsettings{'ENABLE_LOG'} eq 'on') { $logging=1; };
|
||||
if ($xlratorsettings{'PASSIVE_MODE'} eq 'on') { $passive_mode=1; };
|
||||
if ($xlratorsettings{'LOW_DOWNLOAD_PRIORITY'} eq 'on') { $nice='/bin/nice --adjustment=15 '; };
|
||||
$maxusage = $xlratorsettings{'MAX_DISK_USAGE'};
|
||||
}
|
||||
else
|
||||
{
|
||||
&writelog("Updatexlrator not enabled, exit");
|
||||
exit 0;
|
||||
}
|
||||
if (!$maxusage) { $maxusage=75; };
|
||||
|
||||
if($passive_mode || (&UPDXLT::diskusage($repository) > $maxusage))
|
||||
{
|
||||
# nothing to do
|
||||
&writelog("Running in passive mode or maximum diskusage exceeded, exit");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if (-e "${UPDXLT::swroot}/proxy/settings") { &UPDXLT::readhash("${UPDXLT::swroot}/proxy/settings", \%proxysettings); }
|
||||
|
||||
if (-e "${UPDXLT::swroot}/proxy/advanced/settings")
|
||||
{
|
||||
%proxysettings=();
|
||||
&UPDXLT::readhash("${UPDXLT::swroot}/proxy/advanced/settings", \%proxysettings);
|
||||
}
|
||||
|
||||
|
||||
foreach my $dir (<$repository/download/*>)
|
||||
{
|
||||
if (-d $dir)
|
||||
{
|
||||
foreach my $updatefile (<$dir/*>)
|
||||
{
|
||||
unless ($updatefile =~ /.info$/)
|
||||
{
|
||||
push(@downloads, $updatefile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $updatefile (@downloads)
|
||||
{
|
||||
if(-e "$updatefile.info")
|
||||
{
|
||||
&checkdeaddl($updatefile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# clean lock file
|
||||
close(SEM);
|
||||
unlink "$lockfile";
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub checkdeaddl
|
||||
{
|
||||
my $updatefile = shift;
|
||||
|
||||
my %dlinfo = ();
|
||||
&UPDXLT::readhash("$updatefile.info", \%dlinfo);
|
||||
|
||||
my @http_header = ();
|
||||
my $http_result = '000 n/a';
|
||||
my $returncode = 0;
|
||||
my $remote_size = 0;
|
||||
my $remote_mtime = 0;
|
||||
my $login = '';
|
||||
|
||||
my $cmd_ps = "/bin/ps aux | /bin/grep -E \"(download|wget).*$dlinfo{'SRCURL'}\" | /bin/grep -v \"/bin/grep\"";
|
||||
my @runningdl = `$cmd_ps`;
|
||||
|
||||
if(@runningdl > 0)
|
||||
{
|
||||
# download is still running, no need to restart download
|
||||
return;
|
||||
}
|
||||
|
||||
if (($proxysettings{'UPSTREAM_PROXY'}) && ($proxysettings{'UPSTREAM_USER'}))
|
||||
{
|
||||
$login = "--proxy-user=\"$proxysettings{'UPSTREAM_USER'}\"";
|
||||
if ($proxysettings{'UPSTREAM_PASSWORD'})
|
||||
{
|
||||
$login .= " --proxy-password=\"$proxysettings{'UPSTREAM_PASSWORD'}\"";
|
||||
}
|
||||
}
|
||||
|
||||
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
||||
@http_header = `${UPDXLT::wget} $login --user-agent="${UPDXLT::useragent}" --spider -S $dlinfo{'SRCURL'} 2>&1`;
|
||||
$ENV{'http_proxy'} = '';
|
||||
|
||||
foreach (@http_header)
|
||||
{
|
||||
chomp;
|
||||
if (/^\s*HTTP\/\d+\.\d+\s\d+\s+\w+/) { $http_result = $_; $http_result =~ s/^\s*HTTP\/\d+\.\d+\s+//; }
|
||||
if (/^\s*Content-Length:\s/) { $remote_size = $_; $remote_size =~ s/[^0-9]//g; }
|
||||
if (/^\s*Last-Modified:\s/) { $remote_mtime = $_; $remote_mtime =~ s/^\s*Last-Modified:\s//; $remote_mtime = HTTP::Date::str2time($remote_mtime) }
|
||||
}
|
||||
|
||||
&writelog($updatefile);
|
||||
&writelog("HTTP result: $http_result");
|
||||
&writelog("Source time: $remote_mtime");
|
||||
&writelog("Cached time: " . $dlinfo{'REMOTETIME'});
|
||||
|
||||
if ($http_result =~ /\d+\s+OK$/)
|
||||
{
|
||||
my $cmd = "$nice$UPDXLT::apphome/bin/download $dlinfo{'VENDORID'} $dlinfo{'SRCURL'} $dlinfo{'CFMIRROR'}";
|
||||
|
||||
if ($remote_size > &UPDXLT::diskfree($repository))
|
||||
{
|
||||
&writelog("Can't download file, because remote filesize exceeds maximum diskusage");
|
||||
}
|
||||
elsif ($remote_mtime == $dlinfo{'REMOTETIME'})
|
||||
{
|
||||
# still the same file, continue download
|
||||
&writelog("Status: Ok, continue download");
|
||||
$cmd .= " 1 &";
|
||||
&debuglog("Running command $cmd");
|
||||
system("$cmd");
|
||||
}
|
||||
else
|
||||
{
|
||||
# File is changed on remote site, download from scratch
|
||||
&writelog("Status: Outdated, restart download from scratch");
|
||||
unlink($updatefile);
|
||||
$cmd .= " 0 &";
|
||||
&debuglog("Running command $cmd");
|
||||
system("$cmd");
|
||||
}
|
||||
} else {
|
||||
$_ = $http_result;
|
||||
s/\D+//;
|
||||
if ($_ eq '404')
|
||||
{
|
||||
&writelog("Status: No source");
|
||||
$dlinfo{'STATUS'} = ${UPDXLT::sfNoSource};
|
||||
} else {
|
||||
&writelog("Status: Error");
|
||||
$dlinfo{'STATUS'} = ${UPDXLT::sfUnknown};
|
||||
}
|
||||
&UPDXLT::writehash("$updatefile.info", \%dlinfo);
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub writelog
|
||||
{
|
||||
if ($logging)
|
||||
{
|
||||
open (LOGFILE,">>$logfile");
|
||||
my @now = localtime(time);
|
||||
printf LOGFILE "%04d-%02d-%02d %02d:%02d:%02d [%d] %s\n",$now[5]+1900,$now[4]+1,$now[3],$now[2],$now[1],$now[0],$$,$_[0];
|
||||
close LOGFILE;
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub debuglog
|
||||
{
|
||||
if ($debug)
|
||||
{
|
||||
open(LOGFILE,">>/var/log/updatexlrator/debug.log");
|
||||
my @now = localtime(time);
|
||||
printf LOGFILE "%04d-%02d-%02d %02d:%02d:%02d [%d] [%s] %s\n",$now[5]+1900,$now[4]+1,$now[3],$now[2],$now[1],$now[0],$$,"updxlrator",$_[0];
|
||||
close(LOGFILE);
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
@@ -4,18 +4,19 @@
|
||||
#
|
||||
# (c) 2006-2008 marco.s - http://update-accelerator.advproxy.net
|
||||
#
|
||||
# $Id: checkup,v 2.0 2007/06/17 00:00:00 marco.s Exp $
|
||||
# Portions (c) 2008 by dotzball - http://www.blockouttraffic.de
|
||||
#
|
||||
# $Id: checkup,v 1.0 2008/07/15 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
use HTTP::Date;
|
||||
|
||||
my $swroot='/var/ipfire';
|
||||
my $apphome="/var/ipfire/updatexlrator";
|
||||
require '/var/ipfire/updatexlrator/updxlrator-lib.pl';
|
||||
|
||||
my $logfile="/var/log/updatexlrator/checkup.log";
|
||||
my $repository='/var/updatecache';
|
||||
my $useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
|
||||
my %proxysettings=();
|
||||
my %xlratorsettings=();
|
||||
my $download=0;
|
||||
@@ -25,24 +26,20 @@ my @sources=();
|
||||
my @updatelist=();
|
||||
my $logging=0;
|
||||
|
||||
my $sfUnknown = "0";
|
||||
my $sfOk = "1";
|
||||
my $sfOutdated = "2";
|
||||
my $sfNoSource = "3";
|
||||
|
||||
if (-e "$swroot/updatexlrator/settings")
|
||||
if (-e "$UPDXLT::swroot/updatexlrator/settings")
|
||||
{
|
||||
&readhash("$swroot/updatexlrator/settings", \%xlratorsettings);
|
||||
&UPDXLT::readhash("$UPDXLT::swroot/updatexlrator/settings", \%xlratorsettings);
|
||||
if ($xlratorsettings{'FULL_AUTOSYNC'} eq 'on') { $download=1; };
|
||||
if ($xlratorsettings{'ENABLE_LOG'} eq 'on') { $logging=1; };
|
||||
}
|
||||
|
||||
if (-e "$swroot/proxy/settings") { &readhash("$swroot/proxy/settings", \%proxysettings); }
|
||||
if (-e "$UPDXLT::swroot/proxy/settings") { &UPDXLT::readhash("$UPDXLT::swroot/proxy/settings", \%proxysettings); }
|
||||
|
||||
if (-e "$swroot/proxy/advanced/settings")
|
||||
if (-e "$UPDXLT::swroot/proxy/advanced/settings")
|
||||
{
|
||||
%proxysettings=();
|
||||
&readhash("$swroot/proxy/advanced/settings", \%proxysettings);
|
||||
&UPDXLT::readhash("$UPDXLT::swroot/proxy/advanced/settings", \%proxysettings);
|
||||
}
|
||||
|
||||
foreach (<$repository/*>)
|
||||
@@ -70,44 +67,8 @@ foreach (@sources)
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub readhash
|
||||
{
|
||||
my $filename = $_[0];
|
||||
my $hash = $_[1];
|
||||
my ($var, $val);
|
||||
|
||||
if (-e $filename)
|
||||
{
|
||||
open(FILE, $filename) or die "Unable to read file $filename";
|
||||
while (<FILE>)
|
||||
{
|
||||
chop;
|
||||
($var, $val) = split /=/, $_, 2;
|
||||
if ($var)
|
||||
{
|
||||
$val =~ s/^\'//g;
|
||||
$val =~ s/\'$//g;
|
||||
|
||||
# Untaint variables read from hash
|
||||
$var =~ /([A-Za-z0-9_-]*)/; $var = $1;
|
||||
$val =~ /([\w\W]*)/; $val = $1;
|
||||
$hash->{$var} = $val;
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub getmtime
|
||||
{
|
||||
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_[0]);
|
||||
|
||||
return $mtime;
|
||||
}
|
||||
# dotzball: check for dead downloads
|
||||
system("$UPDXLT::apphome/bin/checkdeaddl");
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
@@ -123,14 +84,6 @@ sub writelog
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub setcachestatus
|
||||
{
|
||||
open (FILE,">$_[0]");
|
||||
print FILE "$_[1]\n";
|
||||
close FILE;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
@@ -163,9 +116,8 @@ sub checksource
|
||||
}
|
||||
|
||||
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
||||
@http_header = `wget $login --user-agent="$useragent" --spider -S $url 2>&1`;
|
||||
@http_header = `$UPDXLT::wget $login --user-agent="$UPDXLT::useragent" --spider -S $url 2>&1`;
|
||||
$ENV{'http_proxy'} = '';
|
||||
&writelog(@http_header);
|
||||
|
||||
foreach (@http_header)
|
||||
{
|
||||
@@ -180,23 +132,23 @@ sub checksource
|
||||
&writelog("Source size: $remote_size");
|
||||
&writelog("Cached size: " . (-s $localfile));
|
||||
&writelog("Source time: $remote_mtime");
|
||||
&writelog("Cached time: " . getmtime($localfile));
|
||||
&writelog("Cached time: " . &UPDXLT::getmtime($localfile));
|
||||
|
||||
if ($http_result =~ /\d+\s+OK$/)
|
||||
{
|
||||
if (($remote_size == -s $localfile) && ($remote_mtime == getmtime($localfile)))
|
||||
if (($remote_size == -s $localfile) && ($remote_mtime == &UPDXLT::getmtime($localfile)))
|
||||
{
|
||||
&writelog("Status: Ok");
|
||||
&setcachestatus("$cdir/status",$sfOk);
|
||||
&UPDXLT::setcachestatus("$cdir/status",$UPDXLT::sfOk);
|
||||
} else {
|
||||
&writelog("Status: Outdated");
|
||||
&setcachestatus("$cdir/status",$sfOutdated);
|
||||
&UPDXLT::setcachestatus("$cdir/status",$UPDXLT::sfOutdated);
|
||||
if ($download)
|
||||
{
|
||||
&writelog("Retrieving file from source: $remote_size bytes");
|
||||
$_ = system("wget $login --user-agent=\"$useragent\" -q -O $localfile $url");
|
||||
$_ = system("$UPDXLT::wget $login --user-agent=\"$UPDXLT::useragent\" -q -O $localfile $url");
|
||||
&writelog("Download finished with code: $_");
|
||||
if ($_ == 0) { &setcachestatus("$cdir/status",$sfOk); }
|
||||
if ($_ == 0) { &UPDXLT::setcachestatus("$cdir/status",$UPDXLT::sfOk); }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -205,14 +157,14 @@ sub checksource
|
||||
if ($_ eq '404')
|
||||
{
|
||||
&writelog("Status: No source");
|
||||
&setcachestatus("$cdir/status",$sfNoSource);
|
||||
&UPDXLT::setcachestatus("$cdir/status",$UPDXLT::sfNoSource);
|
||||
} else {
|
||||
&writelog("Status: Error");
|
||||
&setcachestatus("$cdir/status",$sfUnknown);
|
||||
&UPDXLT::setcachestatus("$cdir/status",$UPDXLT::sfUnknown);
|
||||
}
|
||||
}
|
||||
|
||||
&setcachestatus("$cdir/checkup.log",time);
|
||||
|
||||
&UPDXLT::setcachestatus("$cdir/checkup.log",time);
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
@@ -4,37 +4,42 @@
|
||||
#
|
||||
# (c) 2006-2008 marco.s - http://update-accelerator.advproxy.net
|
||||
#
|
||||
# $Id: download,v 2.0 2008/04/06 00:00:00 marco.s Exp $
|
||||
# Portions (c) 2008 by dotzball - http://www.blockouttraffic.de
|
||||
#
|
||||
# $Id: download,v 2.1 2008/07/23 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use HTTP::Date;
|
||||
|
||||
my $swroot='/var/ipfire';
|
||||
my $apphome="$swroot/updatexlrator";
|
||||
require '/var/ipfire/updatexlrator/updxlrator-lib.pl';
|
||||
|
||||
my $logfile="/var/log/updatexlrator/download.log";
|
||||
my $logging=0;
|
||||
my $repository='/var/updatecache';
|
||||
my $login='';
|
||||
my $dlrate='';
|
||||
my $uuid='';
|
||||
my $useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
|
||||
my %xlratorsettings=();
|
||||
my %proxysettings=();
|
||||
my @http_header=();
|
||||
my $remote_size=0;
|
||||
my $remote_mtime=0;
|
||||
my $updatefile='';
|
||||
my $unique=0;
|
||||
my $mirror=1;
|
||||
|
||||
my $sfOk="1";
|
||||
my %dlinfo=();
|
||||
my $wgetContinueFlag="";
|
||||
|
||||
my $vendorid = @ARGV[0]; if ($vendorid eq '') { exit; }
|
||||
my $sourceurl = @ARGV[1]; if ($sourceurl eq '') { exit; }
|
||||
my $cfmirror = @ARGV[2]; if ($cfmirror eq '') { exit; }
|
||||
my $vendorid = $ARGV[0]; if (!defined($vendorid) || $vendorid eq '') { exit; }
|
||||
my $sourceurl = $ARGV[1]; if (!defined($sourceurl) || $sourceurl eq '') { exit; }
|
||||
my $cfmirror = $ARGV[2]; if (!defined($cfmirror) || $cfmirror eq '') { exit; }
|
||||
my $restartdl = defined($ARGV[3]) ? $ARGV[3] : 0;
|
||||
|
||||
umask(0002);
|
||||
|
||||
$sourceurl =~ s@\%2b@+@ig;
|
||||
$sourceurl =~ s@\%2f@/@ig;
|
||||
$sourceurl =~ s@\%7e@~@ig;
|
||||
$updatefile = substr($sourceurl,rindex($sourceurl,"/")+1);
|
||||
@@ -48,9 +53,24 @@ unless (-d "$repository/download/$vendorid")
|
||||
system("chmod 775 $repository/download/$vendorid");
|
||||
}
|
||||
|
||||
exit if (-e "$repository/download/$vendorid/$updatefile");
|
||||
if($restartdl == 0)
|
||||
{
|
||||
# this is a new download
|
||||
exit if (-e "$repository/download/$vendorid/$updatefile");
|
||||
|
||||
# dotzball: Why is this necessary?
|
||||
system("touch $repository/download/$vendorid/$updatefile");
|
||||
$wgetContinueFlag = "-nc";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# this is a restart of a previous (unfinished) download
|
||||
# -> continue download
|
||||
$wgetContinueFlag = "-c";
|
||||
&writelog("Continue download: $updatefile");
|
||||
}
|
||||
|
||||
system("touch $repository/download/$vendorid/$updatefile");
|
||||
|
||||
if ($cfmirror)
|
||||
{
|
||||
@@ -62,19 +82,18 @@ if ($cfmirror)
|
||||
$uuid =~ s/[^0-9a-f]//g;
|
||||
$uuid =~ s/([a-f\d]{8})([a-f\d]{4})([a-f\d]{4})([a-f\d]{4})([a-f\d]{12})/$1-$2-$3-$4-$5/;
|
||||
|
||||
if (-e "$swroot/updatexlrator/settings")
|
||||
if (-e "$UPDXLT::swroot/updatexlrator/settings")
|
||||
{
|
||||
&readhash("$swroot/updatexlrator/settings", \%xlratorsettings);
|
||||
if ($xlratorsettings{'ENABLE_LOG'} eq 'on') { $logging=1; };
|
||||
&UPDXLT::readhash("$UPDXLT::swroot/updatexlrator/settings", \%xlratorsettings);
|
||||
if ($xlratorsettings{'MAX_DOWNLOAD_RATE'} ne '') { $dlrate = "--limit-rate=" . int($xlratorsettings{'MAX_DOWNLOAD_RATE'} / 8) . "k" };
|
||||
}
|
||||
|
||||
if (-e "$swroot/proxy/settings") { &readhash("$swroot/proxy/settings", \%proxysettings); }
|
||||
if (-e "$UPDXLT::swroot/proxy/settings") { &UPDXLT::readhash("$UPDXLT::swroot/proxy/settings", \%proxysettings); }
|
||||
|
||||
if (-e "$swroot/proxy/advanced/settings")
|
||||
if (-e "$UPDXLT::swroot/proxy/advanced/settings")
|
||||
{
|
||||
%proxysettings=();
|
||||
&readhash("$swroot/proxy/advanced/settings", \%proxysettings);
|
||||
&UPDXLT::readhash("$UPDXLT::swroot/proxy/advanced/settings", \%proxysettings);
|
||||
}
|
||||
|
||||
if (($proxysettings{'UPSTREAM_PROXY'}) && ($proxysettings{'UPSTREAM_USER'}))
|
||||
@@ -94,19 +113,44 @@ if ($xlratorsettings{'MAX_DOWNLOAD_RATE'} eq '')
|
||||
}
|
||||
|
||||
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
||||
@http_header = `wget $login --user-agent="$useragent" --spider -S $sourceurl 2>&1`;
|
||||
@http_header = `$UPDXLT::wget $login --user-agent="$UPDXLT::useragent" --spider -S $sourceurl 2>&1`;
|
||||
$ENV{'http_proxy'} = '';
|
||||
|
||||
foreach (@http_header)
|
||||
{
|
||||
chomp;
|
||||
if (/^\s*Content-Length:\s/) { s/[^0-9]//g; &writelog("Remote file size: $_ bytes"); }
|
||||
if (/^\s*Last-Modified:\s/) { s/^\s*Last-Modified:\s//; $remote_mtime = HTTP::Date::str2time($_); &writelog("Remote file date: $_"); }
|
||||
if (/^\s*Content-Length:\s/) { s/[^0-9]//g; $remote_size=$_; &writelog("Remote file size: $_ bytes"); }
|
||||
if (/^\s*Last-Modified:\s/)
|
||||
{
|
||||
s/^\s*Last-Modified:\s//;
|
||||
$remote_mtime = HTTP::Date::str2time($_);
|
||||
&writelog("Remote file date: $_");
|
||||
}
|
||||
}
|
||||
|
||||
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
||||
unlink "$repository/download/$vendorid/$updatefile";
|
||||
$_ = system("wget $login $dlrate --user-agent=\"$useragent\" -q -nc -P $repository/download/$vendorid $sourceurl");
|
||||
|
||||
unless($restartdl)
|
||||
{
|
||||
# this is a new download
|
||||
# -> download from scratch
|
||||
unlink "$repository/download/$vendorid/$updatefile";
|
||||
unlink "$repository/download/$vendorid/$updatefile.info";
|
||||
}
|
||||
|
||||
# save file informations while downloading
|
||||
$dlinfo{'VENDORID'} = $vendorid;
|
||||
$dlinfo{'SRCURL'} = $sourceurl;
|
||||
$dlinfo{'FILENAME'} = $updatefile;
|
||||
$dlinfo{'CFMIRROR'} = $cfmirror;
|
||||
$dlinfo{'REMOTETIME'} = $remote_mtime;
|
||||
$dlinfo{'REMOTESIZE'} = $remote_size;
|
||||
$dlinfo{'STATUS'} = "1";
|
||||
&UPDXLT::writehash("$repository/download/$vendorid/$updatefile.info", \%dlinfo);
|
||||
|
||||
my $cmd = "$UPDXLT::wget $login $dlrate --user-agent=\"$UPDXLT::useragent\" -q -P $repository/download/$vendorid $wgetContinueFlag $sourceurl";
|
||||
|
||||
$_ = system("$cmd");
|
||||
$ENV{'http_proxy'} = '';
|
||||
|
||||
if ($_ == 0)
|
||||
@@ -115,7 +159,7 @@ if ($_ == 0)
|
||||
|
||||
unless (-d "$repository/$vendorid")
|
||||
{
|
||||
system("mkdir -p $repository/$vendorid");
|
||||
system("mkdir -p $repository/$vendorid");
|
||||
system("chown -R nobody.squid $repository/$vendorid");
|
||||
system("chmod 775 $repository/$vendorid");
|
||||
}
|
||||
@@ -134,50 +178,22 @@ if ($_ == 0)
|
||||
utime time,$remote_mtime,"$repository/$vendorid/$uuid/$updatefile";
|
||||
$updatefile =~ s@\\ @ @ig;
|
||||
|
||||
&setcachestatus("$repository/$vendorid/$uuid/source.url",$sourceurl);
|
||||
&setcachestatus("$repository/$vendorid/$uuid/status",$sfOk);
|
||||
&setcachestatus("$repository/$vendorid/$uuid/checkup.log",time);
|
||||
&setcachestatus("$repository/$vendorid/$uuid/access.log",time);
|
||||
&UPDXLT::setcachestatus("$repository/$vendorid/$uuid/source.url",$sourceurl);
|
||||
&UPDXLT::setcachestatus("$repository/$vendorid/$uuid/status",$UPDXLT::sfOk);
|
||||
&UPDXLT::setcachestatus("$repository/$vendorid/$uuid/checkup.log",time);
|
||||
&UPDXLT::setcachestatus("$repository/$vendorid/$uuid/access.log",time);
|
||||
|
||||
system("chown -R nobody.squid $repository/$vendorid/$uuid/*");
|
||||
system("chmod 775 $repository/$vendorid/$uuid/*");
|
||||
|
||||
unlink ("$repository/download/$vendorid/$updatefile.info");
|
||||
|
||||
} else {
|
||||
&writelog("Download finished with result code: ERROR");
|
||||
if (-e "$repository/download/$vendorid/$updatefile") { unlink ("$repository/download/$vendorid/$updatefile"); }
|
||||
}
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub readhash
|
||||
{
|
||||
my $filename = $_[0];
|
||||
my $hash = $_[1];
|
||||
my ($var, $val);
|
||||
|
||||
if (-e $filename)
|
||||
{
|
||||
open(FILE, $filename) or die "Unable to read file $filename";
|
||||
while (<FILE>)
|
||||
{
|
||||
chop;
|
||||
($var, $val) = split /=/, $_, 2;
|
||||
if ($var)
|
||||
{
|
||||
$val =~ s/^\'//g;
|
||||
$val =~ s/\'$//g;
|
||||
|
||||
# Untaint variables read from hash
|
||||
$var =~ /([A-Za-z0-9_-]*)/; $var = $1;
|
||||
$val =~ /([\w\W]*)/; $val = $1;
|
||||
$hash->{$var} = $val;
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub writelog
|
||||
@@ -192,12 +208,3 @@ sub writelog
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub setcachestatus
|
||||
{
|
||||
open (FILE,">$_[0]");
|
||||
print FILE "$_[1]\n";
|
||||
close FILE;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) 2006-2008 marco.s - http://update-accelerator.advproxy.net
|
||||
# (c) 2006-2009 marco.s - http://update-accelerator.advproxy.net
|
||||
#
|
||||
# $Id: updxlrator,v 2.0 2008/04/06 00:00:00 marco.s Exp $
|
||||
# Portions (c) 2008 by dotzball - http://www.blockouttraffic.de
|
||||
#
|
||||
# $Id: updxlrator,v 2.1 2009/01/10 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
@@ -16,6 +18,7 @@ my $swroot="/var/ipfire";
|
||||
my $updcachedir="/var/updatecache";
|
||||
my $apphome="/var/ipfire/updatexlrator";
|
||||
my $logfile="/var/log/updatexlrator/cache.log";
|
||||
my $wget="/usr/bin/wget";
|
||||
my $debug=(-e "$apphome/debug");
|
||||
my $http_port='81';
|
||||
my %netsettings=();
|
||||
@@ -47,6 +50,8 @@ if (-e "$swroot/updatexlrator/settings")
|
||||
}
|
||||
if (!$maxusage) { $maxusage=75; };
|
||||
|
||||
# dotzball: check for dead downloads
|
||||
system("$apphome/bin/checkdeaddl &");
|
||||
|
||||
while (<>) {
|
||||
|
||||
@@ -129,7 +134,7 @@ while (<>) {
|
||||
# -----------------------------------------------------------
|
||||
|
||||
if (
|
||||
(($source_url =~ m@^http://swcdn\.apple\.com/content/downloads/.*\.(tar)$@i) ||
|
||||
(($source_url =~ m@^http://swcdn\.apple\.com/content/downloads/.*\.(tar|pkg)$@i) ||
|
||||
($source_url =~ m@^http://appldnld\.apple\.com\.edgesuite\.net/.*\.(exe|dmg)$@i) ||
|
||||
($source_url =~ m@^http://.*\.g.akamai.net/.*/3093/1/.*\.(tar|pkg|dmg|exe)$@i))
|
||||
)
|
||||
@@ -172,10 +177,10 @@ while (<>) {
|
||||
# Section: AVG Downloads
|
||||
# -----------------------------------------------------------
|
||||
|
||||
if ($source_url =~ m@^http://[^/]*\.(grisoft|avg)\.com/.*\.(bin)$@i)
|
||||
{
|
||||
$xlrator_url = &check_cache($source_url,$hostaddr,$username,"AVG",$mirror);
|
||||
}
|
||||
# if ($source_url =~ m@^http://[^/]*\.(grisoft|avg)\.com/.*\.(bin)$@i)
|
||||
# {
|
||||
# $xlrator_url = &check_cache($source_url,$hostaddr,$username,"AVG",$mirror);
|
||||
# }
|
||||
|
||||
$request="$xlrator_url $hostaddr $username $method\n";
|
||||
|
||||
@@ -341,7 +346,7 @@ sub check_cache
|
||||
if ($proxysettings{'UPSTREAM_PROXY'}) { &debuglog("Using upstream proxy $proxysettings{'UPSTREAM_PROXY'}"); }
|
||||
|
||||
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
||||
@http_header = `wget $login --user-agent="$useragent" --spider -S $sourceurl 2>&1`;
|
||||
@http_header = `$wget $login --user-agent="$useragent" --spider -S $sourceurl 2>&1`;
|
||||
$ENV{'http_proxy'} = '';
|
||||
|
||||
foreach (@http_header)
|
||||
|
||||
144
config/updxlrator/updxlrator-lib.pl
Normal file
144
config/updxlrator/updxlrator-lib.pl
Normal file
@@ -0,0 +1,144 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) 2006-2008 marco.s - http://update-accelerator.advproxy.net
|
||||
#
|
||||
# Portions (c) 2008 by dotzball - http://www.blockouttraffic.de
|
||||
#
|
||||
# dotzball 2008-05-27:
|
||||
# move functions from all local files to one library file
|
||||
#
|
||||
# $Id: updxlrator-lib.pl,v 1.1 2008/11/29 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
package UPDXLT;
|
||||
|
||||
use strict;
|
||||
|
||||
$|=1; # line buffering
|
||||
|
||||
$UPDXLT::swroot='/var/ipfire';
|
||||
$UPDXLT::apphome="/var/ipfire/updatexlrator";
|
||||
|
||||
$UPDXLT::sfUnknown = "0";
|
||||
$UPDXLT::sfOk = "1";
|
||||
$UPDXLT::sfOutdated = "2";
|
||||
$UPDXLT::sfNoSource = "3";
|
||||
|
||||
$UPDXLT::wget="/usr/bin/wget";
|
||||
$UPDXLT::useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub diskfree
|
||||
{
|
||||
open(DF,"/bin/df --block-size=1 $_[0]|");
|
||||
my @dfdata = <DF>;
|
||||
close DF;
|
||||
shift(@dfdata);
|
||||
chomp(@dfdata);
|
||||
my $dfstr = join(' ',@dfdata);
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split(' ',$dfstr);
|
||||
if ($free =~ m/^(\d+)$/)
|
||||
{
|
||||
return $free;
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub diskusage
|
||||
{
|
||||
open(DF,"/bin/df $_[0]|");
|
||||
my @dfdata = <DF>;
|
||||
close DF;
|
||||
shift(@dfdata);
|
||||
chomp(@dfdata);
|
||||
my $dfstr = join(' ',@dfdata);
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split(' ',$dfstr);
|
||||
if ($percent =~ m/^(\d+)%$/)
|
||||
{
|
||||
$percent =~ s/%$//;
|
||||
return $percent;
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
# dotzball (2008-05-26): Copied from IPCop general-functions.pl
|
||||
sub writehash
|
||||
{
|
||||
my $filename = $_[0];
|
||||
my $hash = $_[1];
|
||||
my ($var, $val);
|
||||
|
||||
# write cgi vars to the file.
|
||||
open(FILE, ">${filename}") or die "Unable to write file $filename";
|
||||
flock FILE, 2;
|
||||
foreach $var (keys %$hash)
|
||||
{
|
||||
$val = $hash->{$var};
|
||||
# Darren Critchley Jan 17, 2003 added the following because when submitting with a graphic, the x and y
|
||||
# location of the mouse are submitted as well, this was being written to the settings file causing
|
||||
# some serious grief! This skips the variable.x and variable.y
|
||||
if (!($var =~ /(.x|.y)$/)) {
|
||||
if ($val =~ / /) {
|
||||
$val = "\'$val\'"; }
|
||||
if (!($var =~ /^ACTION/)) {
|
||||
print FILE "${var}=${val}\n"; }
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub readhash
|
||||
{
|
||||
my $filename = $_[0];
|
||||
my $hash = $_[1];
|
||||
my ($var, $val);
|
||||
|
||||
if (-e $filename)
|
||||
{
|
||||
open(FILE, $filename) or die "Unable to read file $filename";
|
||||
while (<FILE>)
|
||||
{
|
||||
chop;
|
||||
($var, $val) = split /=/, $_, 2;
|
||||
if ($var)
|
||||
{
|
||||
$val =~ s/^\'//g;
|
||||
$val =~ s/\'$//g;
|
||||
|
||||
# Untaint variables read from hash
|
||||
$var =~ /([A-Za-z0-9_-]*)/; $var = $1;
|
||||
$val =~ /([\w\W]*)/; $val = $1;
|
||||
$hash->{$var} = $val;
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub getmtime
|
||||
{
|
||||
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_[0]);
|
||||
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub setcachestatus
|
||||
{
|
||||
open (FILE,">$_[0]");
|
||||
print FILE "$_[1]\n";
|
||||
close FILE;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
#!/usr/bin/perl
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) 2006-2008 marco.s - http://update-accelerator.advproxy.net
|
||||
#
|
||||
# Portions (c) 2008 by dotzball - http://www.blockouttraffic.de
|
||||
#
|
||||
# $Id: updatexlrator.cgi,v 2.1.0 2008/07/16 00:00:00 marco.s Exp $
|
||||
#
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# Copyright (C) 2009 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@@ -22,7 +32,7 @@
|
||||
use strict;
|
||||
|
||||
# enable only the following on debugging purpose
|
||||
#use warnings;
|
||||
#use warnings; no warnings 'once';# 'redefine', 'uninitialized';
|
||||
#use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
use IO::Socket;
|
||||
@@ -38,6 +48,7 @@ my %netsettings=();
|
||||
my %mainsettings=();
|
||||
my %proxysettings=();
|
||||
my %xlratorsettings=();
|
||||
my %dlinfo=();
|
||||
my $id=0;
|
||||
my @dfdata=();
|
||||
my $dfstr='';
|
||||
@@ -79,6 +90,8 @@ my $errormessage='';
|
||||
|
||||
my @repositorylist=();
|
||||
my @repositoryfiles=();
|
||||
my @downloadlist=();
|
||||
my @downloadfiles=();
|
||||
|
||||
my @metadata=();
|
||||
|
||||
@@ -100,6 +113,9 @@ $xlratorsettings{'MAX_DOWNLOAD_RATE'} = '';
|
||||
$xlratorsettings{'ENABLE_AUTOCHECK'} = 'off';
|
||||
$xlratorsettings{'FULL_AUTOSYNC'} = 'off';
|
||||
$xlratorsettings{'NOT_ACCESSED_LAST'} = 'month1';
|
||||
$xlratorsettings{'REMOVE_NOSOURCE'} = 'off';
|
||||
$xlratorsettings{'REMOVE_OUTDATED'} = 'off';
|
||||
$xlratorsettings{'REMOVE_OBSOLETE'} = 'off';
|
||||
|
||||
&Header::getcgihash(\%xlratorsettings);
|
||||
|
||||
@@ -258,22 +274,53 @@ if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr remove file'})
|
||||
|
||||
$updatefile = $xlratorsettings{'ID'};
|
||||
|
||||
if ($updatefile =~ /^download\//)
|
||||
unless ($updatefile =~ /^download\//)
|
||||
{
|
||||
($uuid,$vendorid,$updatefile) = split('/',$updatefile);
|
||||
if (-e "$repository/download/$vendorid/$updatefile") { system("rm $repository/download/$vendorid/$updatefile"); }
|
||||
} else {
|
||||
($vendorid,$uuid,$updatefile) = split('/',$updatefile);
|
||||
if (-e "$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
|
||||
}
|
||||
}
|
||||
|
||||
if (($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr cancel download'}) || ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr remove file'}))
|
||||
{
|
||||
$updatefile = $xlratorsettings{'ID'};
|
||||
|
||||
if ($updatefile =~ /^download\//)
|
||||
{
|
||||
($uuid,$vendorid,$updatefile) = split('/',$updatefile);
|
||||
|
||||
if (-e "$repository/download/$vendorid/$updatefile.info")
|
||||
{
|
||||
&General::readhash("$repository/download/$vendorid/$updatefile.info", \%dlinfo);
|
||||
|
||||
$id = &getPID("\\s${General::swroot}/updatexlrator/bin/download\\s.*\\s".quotemeta($dlinfo{'SRCURL'})."\\s\\d\\s\\d\$");
|
||||
if ($id) { system("/bin/kill -9 $id"); }
|
||||
$id = &getPID("\\s/usr/bin/wget\\s.*\\s".quotemeta($dlinfo{'SRCURL'})."\$");
|
||||
if ($id) { system("/bin/kill -9 $id"); }
|
||||
|
||||
system("rm $repository/download/$vendorid/$updatefile.info");
|
||||
}
|
||||
|
||||
if (-e "$repository/download/$vendorid/$updatefile")
|
||||
{
|
||||
system("rm $repository/download/$vendorid/$updatefile");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$not_accessed_last = $xlratorsettings{'NOT_ACCESSED_LAST'};
|
||||
undef($xlratorsettings{'NOT_ACCESSED_LAST'});
|
||||
|
||||
if (-e "${General::swroot}/updatexlrator/settings") { &General::readhash("${General::swroot}/updatexlrator/settings", \%xlratorsettings); }
|
||||
if (-e "${General::swroot}/updatexlrator/settings")
|
||||
{
|
||||
&General::readhash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
|
||||
}
|
||||
|
||||
if ($xlratorsettings{'NOT_ACCESSED_LAST'} eq '') { $xlratorsettings{'NOT_ACCESSED_LAST'} = $not_accessed_last; } ;
|
||||
if ($xlratorsettings{'NOT_ACCESSED_LAST'} eq '')
|
||||
{
|
||||
$xlratorsettings{'NOT_ACCESSED_LAST'} = $not_accessed_last;
|
||||
}
|
||||
|
||||
ERROR:
|
||||
|
||||
@@ -292,8 +339,27 @@ $checked{'ENABLE_AUTOCHECK'}{$xlratorsettings{'ENABLE_AUTOCHECK'}} = "checked='c
|
||||
$checked{'FULL_AUTOSYNC'}{'off'} = '';
|
||||
$checked{'FULL_AUTOSYNC'}{'on'} = '';
|
||||
$checked{'FULL_AUTOSYNC'}{$xlratorsettings{'FULL_AUTOSYNC'}} = "checked='checked'";
|
||||
$checked{'REMOVE_NOSOURCE'}{'off'} = '';
|
||||
$checked{'REMOVE_NOSOURCE'}{'on'} = '';
|
||||
$checked{'REMOVE_NOSOURCE'}{$xlratorsettings{'REMOVE_NOSOURCE'}} = "checked='checked'";
|
||||
$checked{'REMOVE_OUTDATED'}{'off'} = '';
|
||||
$checked{'REMOVE_OUTDATED'}{'on'} = '';
|
||||
$checked{'REMOVE_OUTDATED'}{$xlratorsettings{'REMOVE_OUTDATED'}} = "checked='checked'";
|
||||
$checked{'REMOVE_OBSOLETE'}{'off'} = '';
|
||||
$checked{'REMOVE_OBSOLETE'}{'on'} = '';
|
||||
$checked{'REMOVE_OBSOLETE'}{$xlratorsettings{'REMOVE_OBSOLETE'}} = "checked='checked'";
|
||||
|
||||
|
||||
$selected{'AUTOCHECK_SCHEDULE'}{'daily'} = '';
|
||||
$selected{'AUTOCHECK_SCHEDULE'}{'weekly'} = '';
|
||||
$selected{'AUTOCHECK_SCHEDULE'}{'monthly'} = '';
|
||||
$selected{'AUTOCHECK_SCHEDULE'}{$xlratorsettings{'AUTOCHECK_SCHEDULE'}} = "selected='selected'";
|
||||
|
||||
$selected{'NOT_ACCESSED_LAST'}{'week'} = '';
|
||||
$selected{'NOT_ACCESSED_LAST'}{'month1'} = '';
|
||||
$selected{'NOT_ACCESSED_LAST'}{'month3'} = '';
|
||||
$selected{'NOT_ACCESSED_LAST'}{'month6'} = '';
|
||||
$selected{'NOT_ACCESSED_LAST'}{'year'} = '';
|
||||
$selected{'NOT_ACCESSED_LAST'}{$xlratorsettings{'NOT_ACCESSED_LAST'}} = "selected='selected'";
|
||||
|
||||
# ----------------------------------------------------
|
||||
@@ -397,6 +463,171 @@ END
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
# ----------------------------------------------------
|
||||
# List pending downloads - if any
|
||||
# ----------------------------------------------------
|
||||
|
||||
if (($xlratorsettings{'EXTENDED_GUI'} ne 'statistics') && ($xlratorsettings{'EXTENDED_GUI'} ne 'maintenance'))
|
||||
{
|
||||
@downloadlist = <$repository/download/*>;
|
||||
|
||||
undef(@downloadfiles);
|
||||
foreach (@downloadlist)
|
||||
{
|
||||
if (-d)
|
||||
{
|
||||
my @filelist = <$_/*>;
|
||||
$vendorid = substr($_,rindex($_,"/")+1);
|
||||
foreach(@filelist)
|
||||
{
|
||||
next if(/\.info$/);
|
||||
$updatefile = substr($_,rindex($_,"/")+1);
|
||||
$updatefile .= ":download/$vendorid/$updatefile";
|
||||
$updatefile = " ".$updatefile;
|
||||
push(@downloadfiles, $updatefile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (@downloadfiles)
|
||||
{
|
||||
&Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr pending downloads'}");
|
||||
|
||||
print <<END
|
||||
<table>
|
||||
<tr><td class='boldbase'><b>$Lang::tr{'updxlrtr current downloads'}</b></td></tr>
|
||||
</table>
|
||||
<table width='100%'>
|
||||
<colgroup span='3' width='2%'></colgroup>
|
||||
<colgroup span='1' width='0*'></colgroup>
|
||||
<colgroup span='3' width='5%'></colgroup>
|
||||
<colgroup span='1' width='2%'></colgroup>
|
||||
<tr>
|
||||
<td class='base' align='center'> </td>
|
||||
<td class='base' align='left' colspan='2'><i>$Lang::tr{'updxlrtr source'}</i></td>
|
||||
<td class='base' align='center'><i>$Lang::tr{'updxlrtr filename'}</i></td>
|
||||
<td class='base' align='center'><i>$Lang::tr{'updxlrtr filesize'}</i></td>
|
||||
<td class='base' align='center'><i>$Lang::tr{'date'}</i></td>
|
||||
<td class='base' align='center'><i>$Lang::tr{'updxlrtr progress'}</i></td>
|
||||
<td class='base' align='center'> </td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
$id = 0;
|
||||
foreach $updatefile (@downloadfiles)
|
||||
{
|
||||
$updatefile =~ s/.*://;
|
||||
my $size_updatefile = 0;
|
||||
my $mtime = 0;
|
||||
if(-e "$repository/$updatefile") {
|
||||
$size_updatefile = (-s "$repository/$updatefile");
|
||||
$mtime = &getmtime("$repository/$updatefile");
|
||||
}
|
||||
if (-e "$repository/$updatefile.info") {
|
||||
&General::readhash("$repository/$updatefile.info", \%dlinfo);
|
||||
} else {
|
||||
undef(%dlinfo);
|
||||
}
|
||||
|
||||
$id++;
|
||||
if ($id % 2) {
|
||||
print "<tr bgcolor='$Header::table1colour'>\n"; }
|
||||
else {
|
||||
print "<tr bgcolor='$Header::table2colour'>\n"; }
|
||||
|
||||
$filesize = $size_updatefile;
|
||||
1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
|
||||
|
||||
my ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($mtime);
|
||||
$DAYdt = sprintf ("%.02d",$DAYdt);
|
||||
$MONTHdt = sprintf ("%.02d",$MONTHdt+1);
|
||||
$YEARdt = sprintf ("%.04d",$YEARdt+1900);
|
||||
$filedate = $YEARdt."-".$MONTHdt."-".$DAYdt;
|
||||
|
||||
($uuid,$vendorid,$shortname) = split('/',$updatefile);
|
||||
|
||||
print "\t\t<td align='center' nowrap='nowrap'> ";
|
||||
if (&getPID("\\s/usr/bin/wget\\s.*\\s".quotemeta($dlinfo{'SRCURL'})."\$"))
|
||||
{
|
||||
print "<img src='/images/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /> </td>\n";
|
||||
} else {
|
||||
print "<img src='/images/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition suspended'}' /> </td>\n";
|
||||
}
|
||||
|
||||
print "\t\t<td align='center' nowrap='nowrap'> ";
|
||||
if ($vendorid =~ /^Adobe$/i)
|
||||
{
|
||||
print "<img src='/images/updxl-src-adobe.gif' alt='Adobe'}' /> </td>\n";
|
||||
} elsif ($vendorid =~ /^Microsoft$/i)
|
||||
{
|
||||
print "<img src='/images/updxl-src-windows.gif' alt='Microsoft'}' /> </td>\n";
|
||||
} elsif ($vendorid =~ /^Symantec$/i)
|
||||
{
|
||||
print "<img src='/images/updxl-src-symantec.gif' alt='Symantec'}' /> </td>\n";
|
||||
} elsif ($vendorid =~ /^Linux$/i)
|
||||
{
|
||||
print "<img src='/images/updxl-src-linux.gif' alt='Linux'}' /> </td>\n";
|
||||
} elsif ($vendorid =~ /^TrendMicro$/i)
|
||||
{
|
||||
print "<img src='/images/updxl-src-trendmicro.gif' alt='Trend Micro'}' /> </td>\n";
|
||||
} elsif ($vendorid =~ /^Apple$/i)
|
||||
{
|
||||
print "<img src='/images/updxl-src-apple.gif' alt='Apple'}' /> </td>\n";
|
||||
} elsif ($vendorid =~ /^Avast$/i)
|
||||
{
|
||||
print "<img src='/images/updxl-src-avast.gif' alt='Avast'}' /> </td>\n";
|
||||
} else
|
||||
{
|
||||
if (-e "/home/httpd/html/images/updxl-src-" . $vendorid . ".gif")
|
||||
{
|
||||
print "<img src='/images/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' /> </td>\n";
|
||||
} else {
|
||||
print "<img src='/images/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' /> </td>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$shortname = substr($updatefile,rindex($updatefile,"/")+1);
|
||||
$shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/$1_*$2/i;
|
||||
|
||||
$filesize = $dlinfo{'REMOTESIZE'};
|
||||
1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
|
||||
$dlinfo{'VENDORID'}=ucfirst $vendorid;
|
||||
|
||||
print <<END
|
||||
<td class='base' align='center'> $dlinfo{'VENDORID'} </td>
|
||||
<td class='base' align='left' title='cache:/$updatefile'>$shortname</td>
|
||||
<td class='base' align='right' nowrap='nowrap'> $filesize </td>
|
||||
<td class='base' align='center' nowrap='nowrap'> $filedate </td>
|
||||
<td class='base' align='center' nowrap='nowrap'>
|
||||
END
|
||||
;
|
||||
my $percent="0%";
|
||||
if ($dlinfo{'REMOTESIZE'} && $size_updatefile)
|
||||
{
|
||||
$percent=int(100 / ($dlinfo{'REMOTESIZE'} / $size_updatefile))."%";
|
||||
}
|
||||
print $percent; &percentbar($percent);
|
||||
print <<END
|
||||
</td>
|
||||
<td align='center'>
|
||||
<form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<input type='image' name='$Lang::tr{'updxlrtr cancel download'}' src='/images/delete.gif' title='$Lang::tr{'updxlrtr cancel download'}' alt='$Lang::tr{'updxlrtr cancel download'}' />
|
||||
<input type='hidden' name='ID' value='$updatefile' />
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'updxlrtr cancel download'}' />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
print "</table>\n<br>\n<table>\n";
|
||||
&printlegenddownload();
|
||||
print "</table>\n";
|
||||
|
||||
&Header::closebox();
|
||||
}
|
||||
}
|
||||
# =====================================================================================
|
||||
# CACHE STATISTICS
|
||||
# =====================================================================================
|
||||
@@ -422,6 +653,14 @@ foreach (@sources)
|
||||
{
|
||||
$vendorid=substr($_,rindex($_,'/')+1,length($_));
|
||||
push(@vendors,$vendorid);
|
||||
$vendorstats{$vendorid."_filesize"} = 0;
|
||||
$vendorstats{$vendorid."_requests"} = 0;
|
||||
$vendorstats{$vendorid."_files"} = 0;
|
||||
$vendorstats{$vendorid."_cachehits"} = 0;
|
||||
$vendorstats{$vendorid."_0"} = 0;
|
||||
$vendorstats{$vendorid."_1"} = 0;
|
||||
$vendorstats{$vendorid."_2"} = 0;
|
||||
$vendorstats{$vendorid."_3"} = 0;
|
||||
@updatelist=<$_/*>;
|
||||
foreach $data (@updatelist)
|
||||
{
|
||||
@@ -432,14 +671,24 @@ foreach (@sources)
|
||||
close FILE;
|
||||
chomp($sourceurl);
|
||||
$updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
|
||||
|
||||
my $size_updatefile = 0;
|
||||
if(-e "$data/$updatefile") {
|
||||
$size_updatefile = (-s "$data/$updatefile");
|
||||
}
|
||||
else
|
||||
{
|
||||
# DEBUG
|
||||
#die "file not found: $data/$updatefile\n";
|
||||
}
|
||||
#
|
||||
# Total file size
|
||||
#
|
||||
$filesize += (-s "$data/$updatefile");
|
||||
$filesize += $size_updatefile;
|
||||
#
|
||||
# File size for this source
|
||||
#
|
||||
$vendorstats{$vendorid."_filesize"} += (-s "$data/$updatefile");
|
||||
$vendorstats{$vendorid."_filesize"} += $size_updatefile;
|
||||
#
|
||||
# Number of requests from cache for this source
|
||||
#
|
||||
@@ -470,11 +719,11 @@ foreach (@sources)
|
||||
#
|
||||
# Calculate cached traffic for this source
|
||||
#
|
||||
$vendorstats{$vendorid."_cachehits"} += $counts * (-s "$data/$updatefile");
|
||||
$vendorstats{$vendorid."_cachehits"} += $counts * $size_updatefile;
|
||||
#
|
||||
# Calculate total cached traffic
|
||||
#
|
||||
$cachedtraffic += $counts * (-s "$data/$updatefile");
|
||||
$cachedtraffic += $counts * $size_updatefile;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -742,6 +991,7 @@ foreach (@sources)
|
||||
$vendorid = substr($_,rindex($_,"/")+1);
|
||||
foreach(@updatelist)
|
||||
{
|
||||
next if(/\.info$/);
|
||||
$updatefile = substr($_,rindex($_,"/")+1);
|
||||
$updatefile .= ":download/$vendorid/$updatefile";
|
||||
$updatefile = " ".$updatefile;
|
||||
@@ -833,29 +1083,67 @@ if (@repositoryfiles)
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td class='base' colspan='3'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr purge'}' /> $Lang::tr{'updxlrtr all files'}</td>
|
||||
<td class='base' width='25%'><input type='checkbox' name='REMOVE_OBSOLETE' $checked{'REMOVE_OBSOLETE'}{'on'} /> $Lang::tr{'updxlrtr not accessed'}</td>
|
||||
<td class='base' colspan='3'><select name='NOT_ACCESSED_LAST'>
|
||||
<option value='week' $selected{'NOT_ACCESSED_LAST'}{'week'}>$Lang::tr{'updxlrtr week'}</option>
|
||||
<option value='month1' $selected{'NOT_ACCESSED_LAST'}{'month1'}>$Lang::tr{'updxlrtr month'}</option>
|
||||
<option value='month3' $selected{'NOT_ACCESSED_LAST'}{'month3'}>$Lang::tr{'updxlrtr 3 months'}</option>
|
||||
<option value='month6' $selected{'NOT_ACCESSED_LAST'}{'month6'}>$Lang::tr{'updxlrtr 6 months'}</option>
|
||||
<option value='year' $selected{'NOT_ACCESSED_LAST'}{'year'}>$Lang::tr{'updxlrtr year'}</option>
|
||||
</select>
|
||||
<td class='base' width='25%'>
|
||||
<input type='checkbox' name='REMOVE_OBSOLETE' $checked{'REMOVE_OBSOLETE'}{'on'} /> $Lang::tr{'updxlrtr not accessed'}
|
||||
</td>
|
||||
<td class='base' colspan='3'>
|
||||
<select name='NOT_ACCESSED_LAST'>
|
||||
<option value='week' $selected{'NOT_ACCESSED_LAST'}{'week'}>$Lang::tr{'updxlrtr week'}</option>
|
||||
<option value='month1' $selected{'NOT_ACCESSED_LAST'}{'month1'}>$Lang::tr{'updxlrtr month'}</option>
|
||||
<option value='month3' $selected{'NOT_ACCESSED_LAST'}{'month3'}>$Lang::tr{'updxlrtr 3 months'}</option>
|
||||
<option value='month6' $selected{'NOT_ACCESSED_LAST'}{'month6'}>$Lang::tr{'updxlrtr 6 months'}</option>
|
||||
<option value='year' $selected{'NOT_ACCESSED_LAST'}{'year'}>$Lang::tr{'updxlrtr year'}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base' width='25%'><input type='checkbox' name='REMOVE_NOSOURCE' $checked{'REMOVE_NOSOURCE'}{'on'} /> $Lang::tr{'updxlrtr marked as'}</td>
|
||||
<td class='base' width='25%'>
|
||||
<input type='checkbox' name='REMOVE_NOSOURCE' $checked{'REMOVE_NOSOURCE'}{'on'} /> $Lang::tr{'updxlrtr marked as'}
|
||||
</td>
|
||||
<td class='base' width='3%'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
|
||||
<td class='base' width='17%'>[<i>$Lang::tr{'updxlrtr condition nosource'}</i>]</td>
|
||||
<td class='base' width='25%'><input type='checkbox' name='REMOVE_OUTDATED' $checked{'REMOVE_OUTDATED'}{'on'} /> $Lang::tr{'updxlrtr marked as'}</td>
|
||||
<td class='base' width='25%'>
|
||||
<input type='checkbox' name='REMOVE_OUTDATED' $checked{'REMOVE_OUTDATED'}{'on'} /> $Lang::tr{'updxlrtr marked as'}
|
||||
</td>
|
||||
<td class='base' width='3%'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
|
||||
<td class='base' width='27%'>[<i>$Lang::tr{'updxlrtr condition outdated'}</i>]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<hr size='1'>
|
||||
END
|
||||
;
|
||||
|
||||
&printcurrentfiles($Lang::tr{'updxlrtr current files'}, @repositoryfiles);
|
||||
print "<br>\n<table>\n";
|
||||
&printlegendicons();
|
||||
&printlegendspacer();
|
||||
&printlegendstatus();
|
||||
&printlegendspacer();
|
||||
&printlegendsource();
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
}
|
||||
|
||||
# =====================================================================================
|
||||
|
||||
&Header::closebigbox();
|
||||
|
||||
&Header::closepage();
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub printcurrentfiles
|
||||
{
|
||||
my $title = shift;
|
||||
my @files = @_;
|
||||
|
||||
print <<END
|
||||
<table>
|
||||
<tr><td class='boldbase'><b>$Lang::tr{'updxlrtr current files'}</b></td></tr>
|
||||
</table>
|
||||
@@ -867,9 +1155,9 @@ if (@repositoryfiles)
|
||||
<tr>
|
||||
<td class='base' align='center'> </td>
|
||||
<td class='base' align='center'> </td>
|
||||
<td class='base' align='center'><b>$Lang::tr{'updxlrtr filename'}</b></td>
|
||||
<td class='base' align='center'><b>$Lang::tr{'updxlrtr filesize'}</b></td>
|
||||
<td class='base' align='center'><b>$Lang::tr{'date'}</b></td>
|
||||
<td class='base' align='center'><i>$Lang::tr{'updxlrtr filename'}</i></td>
|
||||
<td class='base' align='center'><i>$Lang::tr{'updxlrtr filesize'}</i></td>
|
||||
<td class='base' align='center'><i>$Lang::tr{'date'}</i></td>
|
||||
<td class='base' align='center'><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
|
||||
<td class='base' align='center'><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
|
||||
<td class='base' align='center'> </td>
|
||||
@@ -877,19 +1165,26 @@ if (@repositoryfiles)
|
||||
END
|
||||
;
|
||||
$id = 0;
|
||||
foreach $updatefile (@repositoryfiles)
|
||||
foreach $updatefile (@files)
|
||||
{
|
||||
$updatefile =~ s/.*://;
|
||||
my $size_updatefile = 0;
|
||||
my $mtime = 0;
|
||||
if(-e "$repository/$updatefile") {
|
||||
$size_updatefile = (-s "$repository/$updatefile");
|
||||
$mtime = &getmtime("$repository/$updatefile");
|
||||
}
|
||||
|
||||
$id++;
|
||||
if ($id % 2) {
|
||||
print "<tr bgcolor='$Header::table1colour'>\n"; }
|
||||
else {
|
||||
print "<tr bgcolor='$Header::table2colour'>\n"; }
|
||||
$filesize = (-s "$repository/$updatefile");
|
||||
|
||||
$filesize = $size_updatefile;
|
||||
1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
|
||||
|
||||
my ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime(&getmtime("$repository/$updatefile"));
|
||||
my ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($mtime);
|
||||
$DAYdt = sprintf ("%.02d",$DAYdt);
|
||||
$MONTHdt = sprintf ("%.02d",$MONTHdt+1);
|
||||
$YEARdt = sprintf ("%.04d",$YEARdt+1900);
|
||||
@@ -1008,7 +1303,7 @@ END
|
||||
}
|
||||
|
||||
$shortname = substr($updatefile,rindex($updatefile,"/")+1);
|
||||
$shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/\1_*\2/i;
|
||||
$shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/$1_*$2/i;
|
||||
|
||||
print <<END
|
||||
<td class='base' align='left' title='cache:/$updatefile'><a href="/updatecache/$updatefile">$shortname</a></td>
|
||||
@@ -1028,10 +1323,41 @@ END
|
||||
;
|
||||
}
|
||||
|
||||
print <<END
|
||||
</table>
|
||||
<br>
|
||||
<table>
|
||||
print "</table>\n";
|
||||
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub printlegenddownload
|
||||
{
|
||||
print <<END
|
||||
<tr>
|
||||
<td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td>
|
||||
<td class='base'> </td>
|
||||
<td><img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr condition download'}</td>
|
||||
<td class='base'> </td>
|
||||
<td class='base'> </td>
|
||||
<td><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition suspended'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr condition suspended'}</td>
|
||||
<td class='base'> </td>
|
||||
<td class='base'> </td>
|
||||
<td><img src='/images/delete.gif' alt='$Lang::tr{'updxlrtr cancel download'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr cancel download'}</td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub printlegendicons
|
||||
{
|
||||
print <<END
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td>
|
||||
<td class='base'> </td>
|
||||
@@ -1041,15 +1367,21 @@ print <<END
|
||||
<td><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr last checkup'}</td>
|
||||
<td class='base'> </td>
|
||||
<td><img src='/images/delete.gif' alt='$Lang::tr{'updxlrtr remove file'}' /></td>
|
||||
<td><img src='/images/updbooster/delete.gif' alt='$Lang::tr{'updxlrtr remove file'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr remove file'}</td>
|
||||
<td class='base'> </td>
|
||||
<td class='base'> </td>
|
||||
<td class='base'> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='13'><br></td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub printlegendstatus
|
||||
{
|
||||
print <<END
|
||||
<tr>
|
||||
<td class='base'> $Lang::tr{'status'}:</td>
|
||||
<td class='base'> </td>
|
||||
@@ -1062,7 +1394,8 @@ print <<END
|
||||
<td align='center'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr condition outdated'}</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'> </td>
|
||||
<td class='base'> </td>
|
||||
|
||||
<td class='base'> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -1074,16 +1407,26 @@ print <<END
|
||||
<td align='center'><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr condition unknown'}</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'> </td>
|
||||
<td class='base'> </td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'> </td>
|
||||
<td class='base'> </td>
|
||||
<td class='base'> </td>
|
||||
|
||||
<td class='base'> </td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub printlegendsource
|
||||
{
|
||||
print <<END
|
||||
<tr>
|
||||
<td colspan='13'> <br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
|
||||
|
||||
<td class='base'> $Lang::tr{'updxlrtr source'}:</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'><img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe' /></td>
|
||||
@@ -1131,24 +1474,24 @@ print <<END
|
||||
<td align='center'></td>
|
||||
<td class='base'> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
END
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
&Header::closebox();
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub printlegendspacer
|
||||
{
|
||||
print <<END
|
||||
<tr>
|
||||
<td colspan='13'> <br></td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
# =====================================================================================
|
||||
|
||||
# ----------------------------------------------------
|
||||
|
||||
&Header::closebigbox();
|
||||
|
||||
&Header::closepage();
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub savesettings
|
||||
@@ -1176,6 +1519,13 @@ sub savesettings
|
||||
symlink("/bin/false",$chk_cron_mly)
|
||||
}
|
||||
|
||||
# don't save those variable to the settings file,
|
||||
# but we wan't to have them in the hash again after saving to file
|
||||
my $obsolete = $xlratorsettings{'REMOVE_OBSOLETE'};
|
||||
my $nosource = $xlratorsettings{'REMOVE_NOSOURCE'};
|
||||
my $outdated = $xlratorsettings{'REMOVE_OUTDATED'};
|
||||
my $gui = $xlratorsettings{'EXTENDED_GUI'};
|
||||
|
||||
delete($xlratorsettings{'REMOVE_OBSOLETE'});
|
||||
delete($xlratorsettings{'REMOVE_NOSOURCE'});
|
||||
delete($xlratorsettings{'REMOVE_OUTDATED'});
|
||||
@@ -1183,6 +1533,12 @@ sub savesettings
|
||||
delete($xlratorsettings{'EXTENDED_GUI'});
|
||||
|
||||
&General::writehash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
|
||||
|
||||
# put temp variables back into the hash
|
||||
$xlratorsettings{'REMOVE_OBSOLETE'} = $obsolete;
|
||||
$xlratorsettings{'REMOVE_NOSOURCE'} = $nosource;
|
||||
$xlratorsettings{'REMOVE_OUTDATED'} = $outdated;
|
||||
$xlratorsettings{'EXTENDED_GUI'} = $gui;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
@@ -1224,3 +1580,18 @@ sub getmtime
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub getPID
|
||||
{
|
||||
my $pid='';
|
||||
my @psdata=`ps ax --no-heading`;
|
||||
|
||||
foreach (@psdata)
|
||||
{
|
||||
if (/$_[0]/) { ($pid)=/^\s*(\d+)/; }
|
||||
}
|
||||
|
||||
return $pid;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
@@ -1701,6 +1701,13 @@
|
||||
'updxlrtr condition outdated' => 'Veraltet',
|
||||
'updxlrtr condition download' => 'Download',
|
||||
'updxlrtr condition unknown' => 'Unbekannt',
|
||||
'updxlrtr update notification' => 'Update-Benachrichtigung!',
|
||||
'updxlrtr update information' => 'Eine aktualisierte Version steht zum Download bereit. Besuchen Sie <a href="http://update-accelerator.advproxy.net" target="_blank">http://update-accelerator.advproxy.net</a> für weitere Informationen.',
|
||||
'updxlrtr pending downloads' => 'Anstehende Downloads',
|
||||
'updxlrtr current downloads' => 'Dateien beim Download in den lokalen Cache',
|
||||
'updxlrtr progress' => 'Fortschritt',
|
||||
'updxlrtr condition suspended' => 'Ausgesetzt',
|
||||
'updxlrtr cancel download' => 'Download abbrechen',
|
||||
'upgrade' => 'upgrade',
|
||||
'uplink speed' => 'Uplink-Geschwindigkeit (kBit/sek)',
|
||||
'uplink std class' => 'Uploadstandardklasse',
|
||||
|
||||
@@ -1733,6 +1733,13 @@
|
||||
'updxlrtr condition outdated' => 'Out of date',
|
||||
'updxlrtr condition download' => 'Download',
|
||||
'updxlrtr condition unknown' => 'Unknown',
|
||||
'updxlrtr update notification' => 'Update notification!',
|
||||
'updxlrtr update information' => 'There is an updated version available for download. Visit <a href="http://update-accelerator.advproxy.net" target="_blank">http://update-accelerator.advproxy.net</a> for more information.',
|
||||
'updxlrtr pending downloads' => 'Pending downloads',
|
||||
'updxlrtr current downloads' => 'Files being downloaded into the local cache',
|
||||
'updxlrtr progress' => 'Progress',
|
||||
'updxlrtr condition suspended' => 'Suspended',
|
||||
'updxlrtr cancel download' => 'Cancel download',
|
||||
'upgrade' => 'upgrade',
|
||||
'uplink speed' => 'Uplink speed (kbit/sec)',
|
||||
'uplink std class' => 'uplink standard class',
|
||||
|
||||
@@ -106,13 +106,17 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
cp -f $(DIR_SRC)/config/updxlrator/download /var/ipfire/updatexlrator/bin/download
|
||||
cp -f $(DIR_SRC)/config/updxlrator/convert /var/ipfire/updatexlrator/bin/convert
|
||||
cp -f $(DIR_SRC)/config/updxlrator/lscache /var/ipfire/updatexlrator/bin/lscache
|
||||
cp -f $(DIR_SRC)/config/updxlrator/checkdeaddl /var/ipfire/updatexlrator/bin/checkdeaddl
|
||||
|
||||
cp -f $(DIR_SRC)/config/updxlrator/updxlrator-lib.pl /var/ipfire/updatexlrator//updxlrator-lib.pl
|
||||
|
||||
-mkdir -p /usr/lib/squid/errors.ipfire
|
||||
cp -fr $(DIR_SRC)/config/proxy/errors.ipfire/* /usr/lib/squid/errors.ipfire/
|
||||
chmod 755 /usr/sbin/updxlrator /var/ipfire/updatexlrator/bin/checkup \
|
||||
/var/ipfire/updatexlrator/bin/download \
|
||||
/var/ipfire/updatexlrator/bin/convert \
|
||||
/var/ipfire/updatexlrator/bin/lscache
|
||||
/var/ipfire/updatexlrator/bin/lscache \
|
||||
/var/ipfire/updatexlrator/bin/checkdeaddl
|
||||
|
||||
ln -fs /bin/false /var/ipfire/updatexlrator/autocheck/cron.daily
|
||||
ln -fs /bin/false /var/ipfire/updatexlrator/autocheck/cron.monthly
|
||||
|
||||
Reference in New Issue
Block a user