Updatexlrator (not tested yet)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@421 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
@@ -43,10 +43,13 @@ HOME=/
|
||||
# hddshutdown
|
||||
02 * * * * /usr/local/bin/hddshutdown >/dev/null
|
||||
|
||||
# URL Filter
|
||||
# connection-scheduler
|
||||
*/5 * * * * /usr/local/bin/connscheduler timer > /dev/null
|
||||
|
||||
# URL Filter && Update Accelerator
|
||||
%nightly * 3-5 /var/ipfire/urlfilter/autoupdate/cron.daily
|
||||
%weekly * 3-5 /var/ipfire/urlfilter/autoupdate/cron.weekly
|
||||
%monthly * 3-5 * /var/ipfire/urlfilter/autoupdate/cron.monthly
|
||||
|
||||
# connection-scheduler
|
||||
*/5 * * * * /usr/local/bin/connscheduler timer > /dev/null
|
||||
%nightly * 3-5 /var/ipfire/updatexlrator/autocheck/cron.daily
|
||||
%weekly * 3-5 /var/ipfire/updatexlrator/autocheck/cron.weekly
|
||||
%monthly * 3-5 * /var/ipfire/updatexlrator/autocheck/cron.monthly
|
||||
|
||||
@@ -82,3 +82,12 @@ compress
|
||||
notifempty
|
||||
missingok
|
||||
}
|
||||
|
||||
/var/log/updatexlrator/*.log {
|
||||
weekly
|
||||
rotate 4
|
||||
copytruncate
|
||||
compress
|
||||
notifempty
|
||||
missingok
|
||||
}
|
||||
|
||||
248
config/updxlrator/checkup
Normal file
@@ -0,0 +1,248 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) 2006 marco.s
|
||||
#
|
||||
# $Id: checkup,v 1.0 2006/08/30 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
use IO::Socket;
|
||||
use HTTP::Date;
|
||||
|
||||
my $swroot='/var/ipfire';
|
||||
my $scriptpath=substr($0,0,rindex($0,"/"));
|
||||
my $apphome="/var/ipfire/updatexlrator";
|
||||
my $logfile="/var/log/updatexlrator/checkup.log";
|
||||
my $debug=(-e "$apphome/debug");
|
||||
my $repository='/srv/web/ipfire/html/updatecache';
|
||||
my %xlratorsettings=();
|
||||
my $download=0;
|
||||
my $updatefile='';
|
||||
my $sourceurl='';
|
||||
my $remote_size=0;
|
||||
my $local_size=0;
|
||||
my $remote_mtime=0;
|
||||
my $local_mtime=0;
|
||||
my @updatelist=();
|
||||
my @metadata=();
|
||||
|
||||
@updatelist = <$repository/*>;
|
||||
|
||||
my $sfUnknown = "0";
|
||||
my $sfOk = "1";
|
||||
my $sfOutdated = "2";
|
||||
|
||||
if (-e "$swroot/updatexlrator/settings")
|
||||
{
|
||||
&readhash("$swroot/updatexlrator/settings", \%xlratorsettings);
|
||||
if ($xlratorsettings{'FULL_AUTOSYNC'} eq 'on') { $download=1; };
|
||||
}
|
||||
|
||||
foreach (@updatelist)
|
||||
{
|
||||
if (!-d $_)
|
||||
{
|
||||
$updatefile = substr($_,rindex($_,"/")+1);
|
||||
if (-e "$repository/metadata/$updatefile")
|
||||
{
|
||||
open (FILE,"$repository/metadata/$updatefile");
|
||||
@metadata = <FILE>;
|
||||
close FILE;
|
||||
chomp(@metadata);
|
||||
$sourceurl = $metadata[0];
|
||||
|
||||
$remote_size = &getdownloadsize($sourceurl);
|
||||
$local_size = (-s "$repository/$updatefile");
|
||||
|
||||
$remote_mtime = &getlastmod($sourceurl);
|
||||
$local_mtime = &getmtime("$repository/$updatefile");
|
||||
|
||||
if ($remote_mtime eq 0)
|
||||
{
|
||||
$metadata[2] = $sfUnknown;
|
||||
if ($debug) { &writelog("$updatefile - WARNING: Source not found"); }
|
||||
print "$updatefile - WARNING: Source not found\n";
|
||||
}
|
||||
elsif (($local_mtime eq $remote_mtime) && ($local_size == $remote_size))
|
||||
{
|
||||
$metadata[2] = $sfOk;
|
||||
$metadata[3] = time;
|
||||
if ($debug) { &writelog("$updatefile"); }
|
||||
print "$updatefile\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$metadata[2] = $sfOutdated;
|
||||
$metadata[3] = time;
|
||||
if ($debug) { &writelog("$updatefile - WARNING: Out of date"); }
|
||||
print "$updatefile - WARNING: Out of date\n";
|
||||
if ($download)
|
||||
{
|
||||
if ($debug)
|
||||
{
|
||||
1 while $remote_size =~ s/^(-?\d+)(\d{3})/$1.$2/;
|
||||
print "Please wait, retrieving file ($remote_size Byte) from source ...";
|
||||
`$scriptpath/../bin/wget -nd -nv -O $repository/$updatefile $sourceurl >>$logfile 2>&1`;
|
||||
print "\n";
|
||||
} else
|
||||
{
|
||||
`$scriptpath/../bin/wget -nd -nv -O $repository/$updatefile $sourceurl 2>&1`;
|
||||
}
|
||||
$local_mtime = &getmtime("$repository/$updatefile");
|
||||
if ($local_mtime eq $remote_mtime) { $metadata[2] = $sfOk; }
|
||||
}
|
||||
}
|
||||
open (FILE,">$repository/metadata/$updatefile");
|
||||
foreach (@metadata) { print FILE "$_\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 getlastmod
|
||||
{
|
||||
my $remote=0;
|
||||
my @response=();
|
||||
my $lastmoddate=0;
|
||||
|
||||
my $url = $_[0];
|
||||
|
||||
$url =~ s@^(.*)://([^/]*)@@;
|
||||
|
||||
my $proto = $1;
|
||||
my $fqhn = $2;
|
||||
|
||||
if ((-e "$swroot/red/active") && ($proto eq 'http'))
|
||||
{
|
||||
$remote = IO::Socket::INET->new(
|
||||
PeerHost => $fqhn,
|
||||
PeerPort => 'http(80)',
|
||||
Timeout => 1
|
||||
);
|
||||
}
|
||||
|
||||
if ($remote)
|
||||
{
|
||||
print $remote "HEAD $url HTTP/1.0\n";
|
||||
print $remote "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\n";
|
||||
print $remote "Host: $fqhn\n";
|
||||
print $remote "Accept: */*\n\n";
|
||||
while (<$remote>) { push(@response,$_); }
|
||||
close $remote;
|
||||
if ($response[0] =~ /^HTTP\/\d+\.\d+\s\d+\sOK\s*$/)
|
||||
{
|
||||
foreach (@response)
|
||||
{
|
||||
if (/^Last-Modified: /i)
|
||||
{
|
||||
s/^Last-Modified: //i;
|
||||
$lastmoddate=HTTP::Date::str2time($_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $lastmoddate;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub getdownloadsize
|
||||
{
|
||||
my $remote=0;
|
||||
my @response=();
|
||||
my $contentlength=0;
|
||||
|
||||
my $url = $_[0];
|
||||
|
||||
$url =~ s@^(.*)://([^/]*)@@;
|
||||
|
||||
my $proto = $1;
|
||||
my $fqhn = $2;
|
||||
|
||||
if ((-e "$swroot/red/active") && ($proto eq 'http'))
|
||||
{
|
||||
$remote = IO::Socket::INET->new(
|
||||
PeerHost => $fqhn,
|
||||
PeerPort => 'http(80)',
|
||||
Timeout => 1
|
||||
);
|
||||
}
|
||||
|
||||
if ($remote)
|
||||
{
|
||||
print $remote "HEAD $url HTTP/1.0\n";
|
||||
print $remote "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\n";
|
||||
print $remote "Host: $fqhn\n";
|
||||
print $remote "Accept: */*\n\n";
|
||||
while (<$remote>) { push(@response,$_); }
|
||||
close $remote;
|
||||
if ($response[0] =~ /^HTTP\/\d+\.\d+\s\d+\sOK\s*$/)
|
||||
{
|
||||
foreach (@response)
|
||||
{
|
||||
if (/^Content-Length: /i)
|
||||
{
|
||||
s/^Content-Length: //i;
|
||||
$contentlength=int($_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $contentlength;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub writelog
|
||||
{
|
||||
open (LOGFILE,">>$logfile");
|
||||
my @now = localtime(time);
|
||||
printf LOGFILE "%02d:%02d:%02d %s\n",$now[2],$now[1],$now[0],$_[0];
|
||||
close LOGFILE;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
69
config/updxlrator/download
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) 2006 marco.s
|
||||
#
|
||||
# $Id: download,v 1.0 2006/08/30 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
my $apphome="/var/ipfire/updatexlrator";
|
||||
my $logfile="/var/log/updatexlrator/download.log";
|
||||
my $debug=(-e "$apphome/debug");
|
||||
my $updcachedir="/srv/web/ipfire/html/updatecache";
|
||||
my $updfile='';
|
||||
my @metadata=();
|
||||
|
||||
my $sfOk="1";
|
||||
|
||||
my $dsturl=@ARGV[0]; if ($dsturl eq '') { exit; }
|
||||
|
||||
$dsturl =~ s@\%2f@/@ig;
|
||||
$updfile = substr($dsturl,rindex($dsturl,"/")+1);
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Retrieve file
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
if ($debug)
|
||||
{
|
||||
&writelog("Retrieving file for local cache: $updfile");
|
||||
`$apphome/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl >>$logfile 2>&1`;
|
||||
} else
|
||||
{
|
||||
`$apphome/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl 2>&1`;
|
||||
}
|
||||
|
||||
if ($debug) { &writelog("Moving file into the cache directory -> \"$updcachedir/$updfile\""); }
|
||||
system("mv $updcachedir/download/$updfile $updcachedir");
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Write metadata
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
if ($debug) { &writelog("Writing metadata \"$updcachedir/metadata/$updfile\""); }
|
||||
|
||||
open(FILE,"$updcachedir/metadata/$updfile");
|
||||
@metadata = <FILE>;
|
||||
close(FILE);
|
||||
chomp @metadata;
|
||||
$metadata[2]="$sfOk";
|
||||
$metadata[3]=time;
|
||||
open(FILE,">$updcachedir/metadata/$updfile");
|
||||
foreach (@metadata) { print FILE "$_\n"; }
|
||||
print FILE time."\n";
|
||||
close(FILE);
|
||||
|
||||
# ===============================================================
|
||||
|
||||
sub writelog
|
||||
{
|
||||
open (LOGFILE,">>$logfile");
|
||||
my @now = localtime(time);
|
||||
printf LOGFILE "%02d:%02d:%02d %s\n",$now[2],$now[1],$now[0],$_[0];
|
||||
close LOGFILE;
|
||||
}
|
||||
|
||||
# ===============================================================
|
||||
286
config/updxlrator/updxlrator
Normal file
@@ -0,0 +1,286 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) 2006 marco.s
|
||||
#
|
||||
# $Id: updxlrator,v 1.0 2006/10/03 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
use IO::Socket;
|
||||
|
||||
$|=1;
|
||||
|
||||
my $swroot="/var/ipfire";
|
||||
my $updcachedir="/srv/web/ipfire/html/updatecache";
|
||||
my %netsettings=();
|
||||
my %xlratorsettings=();
|
||||
my $http_port="81";
|
||||
my $logfile="/var/log/updatexlrator/cache.log";
|
||||
my $logging=0;
|
||||
my $passive_mode=0;
|
||||
my $maxusage=0;
|
||||
my $nice='';
|
||||
my @tmp=();
|
||||
my $now='';
|
||||
my $request='';
|
||||
my $from_local_cache=0;
|
||||
my $dsturl='';
|
||||
my $hostaddr='';
|
||||
my $username='';
|
||||
my $method='';
|
||||
my @metadata=();
|
||||
|
||||
my $sfNoSource = "0";
|
||||
my $sfOk = "1";
|
||||
my $sfOutdated = "2";
|
||||
|
||||
unless (-d "$updcachedir/metadata")
|
||||
{
|
||||
unless (-d "$updcachedir") { mkdir "$updcachedir"; }
|
||||
mkdir "$updcachedir/metadata";
|
||||
system("chown nobody.squid $updcachedir");
|
||||
system("chmod 775 $updcachedir");
|
||||
system("chown nobody.squid $updcachedir/metadata");
|
||||
system("chmod 775 $updcachedir/metadata");
|
||||
}
|
||||
|
||||
readhash("${swroot}/ethernet/settings", \%netsettings);
|
||||
|
||||
if (-e "$swroot/updatexlrator/settings")
|
||||
{
|
||||
&readhash("$swroot/updatexlrator/settings", \%xlratorsettings);
|
||||
if ($xlratorsettings{'ENABLE_LOG'} eq 'on') { $logging=1; };
|
||||
if ($xlratorsettings{'PASSIVE_MODE'} eq 'on') { $passive_mode=1; };
|
||||
$maxusage=$xlratorsettings{'MAX_DISK_USAGE'};
|
||||
if ($xlratorsettings{'LOW_DOWNLOAD_PRIORITY'} eq 'on') { $nice='/usr/bin/nice --adjustment=15 '; };
|
||||
}
|
||||
if (!$maxusage) { $maxusage=75; };
|
||||
|
||||
|
||||
while (<>) {
|
||||
|
||||
$request=$_;
|
||||
$from_local_cache=0;
|
||||
|
||||
@tmp=split(/ /,$request);
|
||||
chomp(@tmp);
|
||||
|
||||
$dsturl =$tmp[0];
|
||||
$hostaddr=$tmp[1]; while ($hostaddr =~ /.*\/$/) { chop $hostaddr; }
|
||||
$username=$tmp[2]; if ($username eq '') { $username='-'; };
|
||||
$method =$tmp[3];
|
||||
|
||||
if (($method eq 'GET') || ($method eq 'HEAD'))
|
||||
{
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Section: Windows Update / Windows Downloads
|
||||
# -----------------------------------------------------------
|
||||
|
||||
if (
|
||||
(($dsturl =~ m@^http://[^/]*\.microsoft\.com/.*\.(exe|psf|msi)$@i) ||
|
||||
($dsturl =~ m@^http://[^/]*\.windowsupdate\.com/.*\.(exe|psf|cab)$@i))
|
||||
&& ($dsturl !~ m@^http://[^/]*\.microsoft\.com/.*(/autoupd|selfupdate/).*\.cab@i)
|
||||
&& ($dsturl !~ m@\&@)
|
||||
)
|
||||
{
|
||||
$from_local_cache = &cache_access($dsturl,$hostaddr,$username,"Microsoft");
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Section: Adobe Downloads
|
||||
# -----------------------------------------------------------
|
||||
|
||||
if ($dsturl =~ m@^http://(ar)?download\.adobe\.com/.*\.(exe|bin|dmg|idx|gz)$@i)
|
||||
{
|
||||
$from_local_cache = &cache_access($dsturl,$hostaddr,$username,"Adobe");
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Section: Symantec Downloads
|
||||
# -----------------------------------------------------------
|
||||
|
||||
if ($dsturl =~ m@^[f|h]t?tp://[^/]*\.symantec(liveupdate)?\.com/.*\.(exe|zip|xdb)$@i)
|
||||
{
|
||||
$from_local_cache = &cache_access($dsturl,$hostaddr,$username,"Symantec");
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
}
|
||||
|
||||
if ($from_local_cache) { $request="http://$netsettings{'GREEN_ADDRESS'}:$http_port/updatecache/".substr($dsturl,rindex($dsturl,"/")+1)." $hostaddr $username $method\n"; }
|
||||
|
||||
print $request;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
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
|
||||
{
|
||||
open(LOGFILE,">>$logfile");
|
||||
print LOGFILE time." $_[0] $_[1] $_[2] $_[3] $_[4]\n";
|
||||
close(LOGFILE);
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub diskfree
|
||||
{
|
||||
open(DF,"/bin/df --block-size=1 $_[0]|");
|
||||
while(<DF>)
|
||||
{
|
||||
unless ($_ =~ m/^Filesystem/ )
|
||||
{
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split;
|
||||
if ($free =~ m/^(\d+)$/)
|
||||
{
|
||||
close DF;
|
||||
return $free;
|
||||
}
|
||||
}
|
||||
}
|
||||
close DF;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub diskusage
|
||||
{
|
||||
open(DF,"/bin/df $_[0]|");
|
||||
while(<DF>)
|
||||
{
|
||||
unless ($_ =~ m/^Filesystem/ )
|
||||
{
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split;
|
||||
if ($percent =~ m/^(\d+)%$/)
|
||||
{
|
||||
close DF;
|
||||
$percent =~ s/%$//;
|
||||
return $percent;
|
||||
}
|
||||
}
|
||||
}
|
||||
close DF;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub getdownloadsize
|
||||
{
|
||||
my $remote=0;
|
||||
my @response=();
|
||||
my $contentlength=0;
|
||||
|
||||
my $url = $_[0];
|
||||
|
||||
$url =~ s@^(.*)://([^/]*)@@;
|
||||
|
||||
my $proto = $1;
|
||||
my $fqhn = $2;
|
||||
|
||||
if ((-e "$swroot/red/active") && ($proto eq 'http'))
|
||||
{
|
||||
$remote = IO::Socket::INET->new(
|
||||
PeerHost => $fqhn,
|
||||
PeerPort => 'http(80)',
|
||||
Timeout => 1
|
||||
);
|
||||
}
|
||||
|
||||
if ($remote)
|
||||
{
|
||||
print $remote "HEAD $url HTTP/1.0\n";
|
||||
print $remote "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\n";
|
||||
print $remote "Host: $fqhn\n";
|
||||
print $remote "Accept: */*\n\n";
|
||||
while (<$remote>) { push(@response,$_); }
|
||||
close $remote;
|
||||
if ($response[0] =~ /^HTTP\/\d+\.\d+\s\d+\sOK\s*$/)
|
||||
{
|
||||
foreach (@response)
|
||||
{
|
||||
if (/^Content-Length: /i)
|
||||
{
|
||||
s/^Content-Length: //i;
|
||||
$contentlength=$_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $contentlength;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub cache_access
|
||||
{
|
||||
my $updsource="UPDCACHE";
|
||||
my $updfile='';
|
||||
my $do_redirect=0;
|
||||
|
||||
$_[0] =~ s@\%2f@/@ig;
|
||||
$updfile = substr($_[0],rindex($_[0],"/")+1);
|
||||
|
||||
if (!-e "$updcachedir/metadata/$updfile")
|
||||
{
|
||||
open(FILE,">$updcachedir/metadata/$updfile");
|
||||
print FILE "$_[0]\n$_[3]\n$sfOutdated\n0\n";
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
if (-e "$updcachedir/$updfile")
|
||||
{
|
||||
open(FILE,">>$updcachedir/metadata/$updfile");
|
||||
print FILE time."\n";
|
||||
close(FILE);
|
||||
$do_redirect=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$updsource="DLSOURCE";
|
||||
if ((!$passive_mode) && (&diskusage($updcachedir) <= $maxusage) && (&getdownloadsize <= &diskfree($updcachedir)) && (!-e "$updcachedir/download/$updfile"))
|
||||
{
|
||||
system("$nice/var/ipfire/updatexlrator/bin/download $_[0] &");
|
||||
}
|
||||
}
|
||||
|
||||
if ($logging) { &writelog($_[1],$_[2],$_[3],$updsource,$_[0]); }
|
||||
|
||||
return $do_redirect;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
723
html/cgi-bin/updatexlrator.cgi
Normal file
@@ -0,0 +1,723 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# IPCop CGIs
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) 2006 marco.s
|
||||
#
|
||||
# $Id: updatexlrator.cgi,v 1.0.0 2006/09/12 00:00:00 marco.s Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
# enable only the following on debugging purpose
|
||||
#use warnings;
|
||||
#use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
use IO::Socket;
|
||||
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
|
||||
my $updxlratorversion = `cat ${General::swroot}/updatexlrator/version`;
|
||||
my $sysupdflagfile = "${General::swroot}/updatexlrator/.up2date";
|
||||
|
||||
my %checked=();
|
||||
my %selected=();
|
||||
my %netsettings=();
|
||||
my %mainsettings=();
|
||||
my %proxysettings=();
|
||||
my %xlratorsettings=();
|
||||
my $id=0;
|
||||
my $updatefile='';
|
||||
my $shortname='';
|
||||
my $vendor='';
|
||||
my $time='';
|
||||
my $filesize=0;
|
||||
my $filedate='';
|
||||
my $lastaccess='';
|
||||
my $lastcheck='';
|
||||
|
||||
my $repository = "/srv/web/ipfire/html/updatecache";
|
||||
my $hintcolour = '#FFFFCC';
|
||||
|
||||
my $sfNoSource='0';
|
||||
my $sfOk='1';
|
||||
my $sfOutdated='2';
|
||||
|
||||
my $not_accessed_last='';
|
||||
|
||||
my $errormessage='';
|
||||
|
||||
my @repositorylist=();
|
||||
my @repositoryfiles=();
|
||||
|
||||
my @metadata=();
|
||||
|
||||
my $chk_cron_dly = "${General::swroot}/updatexlrator/autocheck/cron.daily";
|
||||
my $chk_cron_wly = "${General::swroot}/updatexlrator/autocheck/cron.weekly";
|
||||
my $chk_cron_mly = "${General::swroot}/updatexlrator/autocheck/cron.monthly";
|
||||
|
||||
my $latest=substr(&check4updates,0,length($updxlratorversion));
|
||||
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
|
||||
|
||||
$xlratorsettings{'ACTION'} = '';
|
||||
$xlratorsettings{'ENABLE_LOG'} = 'off';
|
||||
$xlratorsettings{'CHILDREN'} = '5';
|
||||
$xlratorsettings{'PASSIVE_MODE'} = 'off';
|
||||
$xlratorsettings{'MAX_DISK_USAGE'} = '75';
|
||||
$xlratorsettings{'LOW_DOWNLOAD_PRIORITY'} = 'off';
|
||||
$xlratorsettings{'ENABLE_AUTOCHECK'} = 'off';
|
||||
$xlratorsettings{'FULL_AUTOSYNC'} = 'off';
|
||||
$xlratorsettings{'NOT_ACCESSED_LAST'} = 'month1';
|
||||
|
||||
&Header::getcgihash(\%xlratorsettings);
|
||||
|
||||
if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr purge'})
|
||||
{
|
||||
if (($xlratorsettings{'REMOVE_OBSOLETE'} eq 'on') || ($xlratorsettings{'REMOVE_NOSOURCE'} eq 'on') || ($xlratorsettings{'REMOVE_OUTDATED'} eq 'on'))
|
||||
{
|
||||
@repositorylist = <$repository/*>;
|
||||
foreach (@repositorylist)
|
||||
{
|
||||
if (!-d $_)
|
||||
{
|
||||
$updatefile = substr($_,rindex($_,"/")+1);
|
||||
if (-e "$repository/metadata/$updatefile")
|
||||
{
|
||||
open (FILE,"$repository/metadata/$updatefile");
|
||||
@metadata = <FILE>;
|
||||
close FILE;
|
||||
chomp(@metadata);
|
||||
|
||||
if (($xlratorsettings{'REMOVE_NOSOURCE'} eq 'on') && ($metadata[2] == $sfNoSource))
|
||||
{
|
||||
unlink("$repository/$updatefile");
|
||||
unlink("$repository/metadata/$updatefile");
|
||||
}
|
||||
if (($xlratorsettings{'REMOVE_OUTDATED'} eq 'on') && ($metadata[2] == $sfOutdated))
|
||||
{
|
||||
unlink("$repository/$updatefile");
|
||||
unlink("$repository/metadata/$updatefile");
|
||||
}
|
||||
if ($xlratorsettings{'REMOVE_OBSOLETE'} eq 'on')
|
||||
{
|
||||
if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'week') && ($metadata[-1] < (time - 604800)))
|
||||
{
|
||||
unlink("$repository/$updatefile");
|
||||
unlink("$repository/metadata/$updatefile");
|
||||
}
|
||||
if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month1') && ($metadata[-1] < (time - 2505600)))
|
||||
{
|
||||
unlink("$repository/$updatefile");
|
||||
unlink("$repository/metadata/$updatefile");
|
||||
}
|
||||
if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month3') && ($metadata[-1] < (time - 7516800)))
|
||||
{
|
||||
unlink("$repository/$updatefile");
|
||||
unlink("$repository/metadata/$updatefile");
|
||||
}
|
||||
if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month6') && ($metadata[-1] < (time - 15033600)))
|
||||
{
|
||||
unlink("$repository/$updatefile");
|
||||
unlink("$repository/metadata/$updatefile");
|
||||
}
|
||||
if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'year') && ($metadata[-1] < (time - 31536000)))
|
||||
{
|
||||
unlink("$repository/$updatefile");
|
||||
unlink("$repository/metadata/$updatefile");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($xlratorsettings{'ACTION'} eq $Lang::tr{'save'})
|
||||
{
|
||||
if (!($xlratorsettings{'CHILDREN'} =~ /^\d+$/) || ($xlratorsettings{'CHILDREN'} < 1))
|
||||
{
|
||||
$errormessage = $Lang::tr{'updxlrtr invalid num of children'};
|
||||
goto ERROR;
|
||||
}
|
||||
if (!($xlratorsettings{'MAX_DISK_USAGE'} =~ /^\d+$/) || ($xlratorsettings{'MAX_DISK_USAGE'} < 1) || ($xlratorsettings{'MAX_DISK_USAGE'} > 100))
|
||||
{
|
||||
$errormessage = $Lang::tr{'updxlrtr invalid disk usage'};
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
&savesettings;
|
||||
}
|
||||
|
||||
if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr save and restart'})
|
||||
{
|
||||
if (!($xlratorsettings{'CHILDREN'} =~ /^\d+$/) || ($xlratorsettings{'CHILDREN'} < 1))
|
||||
{
|
||||
$errormessage = $Lang::tr{'updxlrtr invalid num of children'};
|
||||
goto ERROR;
|
||||
}
|
||||
if (!($xlratorsettings{'MAX_DISK_USAGE'} =~ /^\d+$/) || ($xlratorsettings{'MAX_DISK_USAGE'} < 1) || ($xlratorsettings{'MAX_DISK_USAGE'} > 100))
|
||||
{
|
||||
$errormessage = $Lang::tr{'updxlrtr invalid disk usage'};
|
||||
goto ERROR;
|
||||
}
|
||||
if (!(-e "${General::swroot}/proxy/enable"))
|
||||
{
|
||||
$errormessage = $Lang::tr{'updxlrtr web proxy service required'};
|
||||
goto ERROR;
|
||||
}
|
||||
if (!($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on'))
|
||||
{
|
||||
$errormessage = $Lang::tr{'updxlrtr not enabled'};
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
&savesettings;
|
||||
|
||||
system('/usr/local/bin/restartsquid');
|
||||
}
|
||||
|
||||
if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr remove file'})
|
||||
{
|
||||
$updatefile = $xlratorsettings{'ID'};
|
||||
if (-e "$repository/$updatefile") { unlink("$repository/$updatefile"); }
|
||||
$updatefile =~ s/^download\///i;
|
||||
if (-e "$repository/metadata/$updatefile") { unlink("$repository/metadata/$updatefile"); }
|
||||
}
|
||||
|
||||
ERROR:
|
||||
|
||||
$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 ($xlratorsettings{'NOT_ACCESSED_LAST'} eq '') { $xlratorsettings{'NOT_ACCESSED_LAST'} = $not_accessed_last; } ;
|
||||
|
||||
|
||||
$checked{'ENABLE_LOG'}{'off'} = '';
|
||||
$checked{'ENABLE_LOG'}{'on'} = '';
|
||||
$checked{'ENABLE_LOG'}{$xlratorsettings{'ENABLE_LOG'}} = "checked='checked'";
|
||||
$checked{'PASSIVE_MODE'}{'off'} = '';
|
||||
$checked{'PASSIVE_MODE'}{'on'} = '';
|
||||
$checked{'PASSIVE_MODE'}{$xlratorsettings{'PASSIVE_MODE'}} = "checked='checked'";
|
||||
$checked{'LOW_DOWNLOAD_PRIORITY'}{'off'} = '';
|
||||
$checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} = '';
|
||||
$checked{'LOW_DOWNLOAD_PRIORITY'}{$xlratorsettings{'LOW_DOWNLOAD_PRIORITY'}} = "checked='checked'";
|
||||
$checked{'ENABLE_AUTOCHECK'}{'off'} = '';
|
||||
$checked{'ENABLE_AUTOCHECK'}{'on'} = '';
|
||||
$checked{'ENABLE_AUTOCHECK'}{$xlratorsettings{'ENABLE_AUTOCHECK'}} = "checked='checked'";
|
||||
$checked{'FULL_AUTOSYNC'}{'off'} = '';
|
||||
$checked{'FULL_AUTOSYNC'}{'on'} = '';
|
||||
$checked{'FULL_AUTOSYNC'}{$xlratorsettings{'FULL_AUTOSYNC'}} = "checked='checked'";
|
||||
|
||||
$selected{'AUTOCHECK_SCHEDULE'}{$xlratorsettings{'AUTOCHECK_SCHEDULE'}} = "selected='selected'";
|
||||
$selected{'NOT_ACCESSED_LAST'}{$xlratorsettings{'NOT_ACCESSED_LAST'}} = "selected='selected'";
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Settings dialog
|
||||
# ----------------------------------------------------
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
&Header::openpage($Lang::tr{'updxlrtr configuration'}, 1, '');
|
||||
|
||||
&Header::openbigbox('100%', 'left', '', $errormessage);
|
||||
|
||||
if ($errormessage) {
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
|
||||
print "<font class='base'>$errormessage </font>\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
if (($updxlratorversion lt $latest) && (-e $sysupdflagfile)) { unlink($sysupdflagfile); }
|
||||
|
||||
if (!-e $sysupdflagfile) {
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'updxlrtr update notification'});
|
||||
print "<table width='100%' cellpadding='5'>\n";
|
||||
print "<tr>\n";
|
||||
print "<td bgcolor='$hintcolour' class='base'>$Lang::tr{'updxlrtr update information'}</td>";
|
||||
print "</tr>\n";
|
||||
print "</table>\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
print "<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>\n";
|
||||
|
||||
&Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr update accelerator'}");
|
||||
|
||||
print <<END
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td colspan='4'><b>$Lang::tr{'updxlrtr common settings'}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base' width='25%'>$Lang::tr{'updxlrtr enable log'}:</td>
|
||||
<td class='base' width='20%'><input type='checkbox' name='ENABLE_LOG' $checked{'ENABLE_LOG'}{'on'} /></td>
|
||||
<td class='base' width='25%'>$Lang::tr{'updxlrtr children'}:</td>
|
||||
<td class='base' width='30%'><input type='text' name='CHILDREN' value='$xlratorsettings{'CHILDREN'}' size='5' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base'>$Lang::tr{'updxlrtr passive mode'}:</td>
|
||||
<td class='base'><input type='checkbox' name='PASSIVE_MODE' $checked{'PASSIVE_MODE'}{'on'} /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr max disk usage'}:</td>
|
||||
<td class='base'><input type='text' name='MAX_DISK_USAGE' value='$xlratorsettings{'MAX_DISK_USAGE'}' size='1' /> %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base'>$Lang::tr{'updxlrtr low download priority'}:</td>
|
||||
<td class='base'><input type='checkbox' name='LOW_DOWNLOAD_PRIORITY' $checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} /></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size='1'>
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td colspan='4'><b>$Lang::tr{'updxlrtr source checkup'}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base' width='25%'>$Lang::tr{'updxlrtr enable autocheck'}:</td>
|
||||
<td class='base' width='20%'><input type='checkbox' name='ENABLE_AUTOCHECK' $checked{'ENABLE_AUTOCHECK'}{'on'} /></td>
|
||||
<td class='base' width='25%'>$Lang::tr{'updxlrtr source checkup schedule'}:</td>
|
||||
<td class='base' width='30%'>
|
||||
<select name='AUTOCHECK_SCHEDULE'>
|
||||
<option value='daily' $selected{'AUTOCHECK_SCHEDULE'}{'daily'}>$Lang::tr{'updxlrtr daily'}</option>
|
||||
<option value='weekly' $selected{'AUTOCHECK_SCHEDULE'}{'weekly'}>$Lang::tr{'updxlrtr weekly'}</option>
|
||||
<option value='monthly' $selected{'AUTOCHECK_SCHEDULE'}{'monthly'}>$Lang::tr{'updxlrtr monthly'}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base'>$Lang::tr{'updxlrtr full autosync'}:</td>
|
||||
<td class='base'><input type='checkbox' name='FULL_AUTOSYNC' $checked{'FULL_AUTOSYNC'}{'on'} /></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size='1'>
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td colspan='6'><b>$Lang::tr{'updxlrtr maintenance'}</b></td>
|
||||
</tr>
|
||||
<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>
|
||||
</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='3%'><img src='/images/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='3%'><img src='/images/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>
|
||||
<hr size='1'>
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td align='center' width='45%'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
|
||||
<td align='center' width='45%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr save and restart'}' /></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td align='right'>
|
||||
<sup><small><a href='http://www.advproxy.net/update-accelerator/' target='_blank'>Update Accelerator $updxlratorversion</a></small></sup>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
;
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
# ----------------------------------------------------
|
||||
# File list dialog
|
||||
# ----------------------------------------------------
|
||||
|
||||
&Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr current files'}:");
|
||||
|
||||
@repositorylist = <$repository/download/*>;
|
||||
|
||||
undef @repositoryfiles;
|
||||
foreach (@repositorylist)
|
||||
{
|
||||
if (!-d)
|
||||
{
|
||||
$updatefile = substr($_,rindex($_,"/")+1);
|
||||
$updatefile = "download/$updatefile";
|
||||
push(@repositoryfiles,$updatefile);
|
||||
}
|
||||
}
|
||||
|
||||
@repositorylist = <$repository/*>;
|
||||
|
||||
foreach (@repositorylist)
|
||||
{
|
||||
if (!-d) { push(@repositoryfiles,substr($_,rindex($_,"/")+1)); }
|
||||
}
|
||||
|
||||
if (@repositoryfiles)
|
||||
{
|
||||
print <<END
|
||||
<table width='100%'>
|
||||
<colgroup span='2' width='2%'></colgroup>
|
||||
<colgroup span='1' width='0*'></colgroup>
|
||||
<colgroup span='4' width='5%'></colgroup>
|
||||
<colgroup span='1' width='2%'></colgroup>
|
||||
<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'><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
|
||||
<td class='base' align='center'><img src='/images/floppy.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
|
||||
<td class='base' align='center'> </td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
$id = 0;
|
||||
foreach $updatefile (@repositoryfiles)
|
||||
{
|
||||
$id++;
|
||||
if ($id % 2) {
|
||||
print "<tr bgcolor='$Header::table1colour'>\n"; }
|
||||
else {
|
||||
print "<tr bgcolor='$Header::table2colour'>\n"; }
|
||||
$filesize = (-s "$repository/$updatefile");
|
||||
1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
|
||||
|
||||
my ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime(&getmtime("$repository/$updatefile"));
|
||||
$DAYdt = sprintf ("%.02d",$DAYdt);
|
||||
$MONTHdt = sprintf ("%.02d",$MONTHdt+1);
|
||||
$YEARdt = sprintf ("%.04d",$YEARdt+1900);
|
||||
$filedate = $YEARdt."-".$MONTHdt."-".$DAYdt;
|
||||
|
||||
$lastaccess = "n/a";
|
||||
$lastcheck = "n/a";
|
||||
undef @metadata;
|
||||
|
||||
$shortname = $updatefile;
|
||||
$shortname =~ s/^download\///i;
|
||||
|
||||
if (-e "$repository/metadata/$shortname")
|
||||
{
|
||||
open (FILE,"$repository/metadata/$shortname");
|
||||
@metadata = <FILE>;
|
||||
close(FILE);
|
||||
chomp @metadata;
|
||||
|
||||
($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($metadata[-1]);
|
||||
$DAYdt = sprintf ("%.02d",$DAYdt);
|
||||
$MONTHdt = sprintf ("%.02d",$MONTHdt+1);
|
||||
$YEARdt = sprintf ("%.04d",$YEARdt+1900);
|
||||
if (($metadata[-1] =~ /^\d+/) && ($metadata[-1] >= 1)) { $lastaccess = $YEARdt."-".$MONTHdt."-".$DAYdt; }
|
||||
|
||||
($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($metadata[3]);
|
||||
$DAYdt = sprintf ("%.02d",$DAYdt);
|
||||
$MONTHdt = sprintf ("%.02d",$MONTHdt+1);
|
||||
$YEARdt = sprintf ("%.04d",$YEARdt+1900);
|
||||
if (($metadata[3] =~ /^\d+/) && ($metadata[3] >= 1)) { $lastcheck = $YEARdt."-".$MONTHdt."-".$DAYdt; }
|
||||
}
|
||||
|
||||
print "\t\t<td align='center' nowrap='nowrap'> ";
|
||||
if ($metadata[2] eq $sfNoSource)
|
||||
{
|
||||
print "<img src='/images/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /> </td>\n";
|
||||
}
|
||||
if ($metadata[2] eq $sfOk)
|
||||
{
|
||||
print "<img src='/images/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /> </td>\n";
|
||||
}
|
||||
if (($metadata[2] eq $sfOutdated) && (!($updatefile =~ /^download\//i)))
|
||||
{
|
||||
print "<img src='/images/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /> </td>\n";
|
||||
}
|
||||
if (($metadata[2] eq $sfOutdated) && ($updatefile =~ /^download\//i))
|
||||
{
|
||||
print "<img src='/images/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /> </td>\n";
|
||||
}
|
||||
if ($metadata[2] eq '')
|
||||
{
|
||||
print "<img src='/images/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /> </td>\n";
|
||||
}
|
||||
|
||||
print "\t\t<td align='center' nowrap='nowrap'> ";
|
||||
if ($metadata[1] eq 'Adobe')
|
||||
{
|
||||
print "<img src='/images/updxl-src-adobe.gif' alt='Adobe'}' /> </td>\n";
|
||||
} elsif ($metadata[1] eq 'Microsoft')
|
||||
{
|
||||
print "<img src='/images/updxl-src-windows.gif' alt='Microsoft'}' /> </td>\n";
|
||||
} elsif ($metadata[1] eq 'Symantec')
|
||||
{
|
||||
print "<img src='/images/updxl-src-symantec.gif' alt='Symantec'}' /> </td>\n";
|
||||
} else
|
||||
{
|
||||
print "<img src='/images/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr unknown'}' /> </td>\n";
|
||||
}
|
||||
|
||||
$shortname = $updatefile;
|
||||
$shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/\1_*\2/i;
|
||||
$shortname =~ s/^download\///i;
|
||||
|
||||
print <<END
|
||||
<td class='base' align='left' title='$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'> $lastaccess </td>
|
||||
<td class='base' align='center' nowrap='nowrap'> $lastcheck </td>
|
||||
<td align='center'>
|
||||
<form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<input type='image' name='$Lang::tr{'updxlrtr remove file'}' src='/images/delete.gif' title='$Lang::tr{'updxlrtr remove file'}' alt='$Lang::tr{'updxlrtr remove file'}' />
|
||||
<input type='hidden' name='ID' value='$updatefile' />
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'updxlrtr remove file'}' />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
print <<END
|
||||
</table>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td>
|
||||
<td class='base'> </td>
|
||||
<td><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr last access'}</td>
|
||||
<td class='base'> </td>
|
||||
<td><img src='/images/floppy.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 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'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base'> $Lang::tr{'status'}:</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'><img src='/images/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr condition ok'}</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'><img src='/images/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr condition nosource'}</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'><img src='/images/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'><img src='/images/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr condition download'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='13'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base'> $Lang::tr{'updxlrtr source'}:</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'><img src='/images/updxl-src-adobe.gif' alt='Adobe' /></td>
|
||||
<td class='base'>Adobe</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'><img src='/images/updxl-src-windows.gif' alt='Microsoft' /></td>
|
||||
<td class='base'>Microsoft</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'><img src='/images/updxl-src-symantec.gif' alt='Symantec' /></td>
|
||||
<td class='base'>Symantec</td>
|
||||
<td class='base'> </td>
|
||||
<td align='center'><img src='/images/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr unknown'}' /></td>
|
||||
<td class='base'>$Lang::tr{'updxlrtr unknown'}</td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
;
|
||||
} else {
|
||||
|
||||
print "<i>$Lang::tr{'updxlrtr empty repository'}</i>\n";
|
||||
}
|
||||
|
||||
print <<END
|
||||
<hr>
|
||||
|
||||
<table>
|
||||
<tr><td class='boldbase'><b>$Lang::tr{'updxlrtr disk usage'}:</b></td></tr>
|
||||
</table>
|
||||
|
||||
<table cellpadding='3'>
|
||||
END
|
||||
;
|
||||
open(DF,"/bin/df -h $repository|");
|
||||
while(<DF>)
|
||||
{
|
||||
if ($_ =~ m/^Filesystem/ )
|
||||
{
|
||||
print <<END
|
||||
<tr>
|
||||
<td align='left' class='base'><i>$Lang::tr{'updxlrtr cache dir'}</i></td>
|
||||
<td align='center' class='base'><i>$Lang::tr{'size'}</i></td>
|
||||
<td align='center' class='base'><i>$Lang::tr{'used'}</i></td>
|
||||
<td align='center' class='base'><i>$Lang::tr{'free'}</i></td>
|
||||
<td align='left' class='base' colspan='2'><i>$Lang::tr{'percentage'}</i></td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split;
|
||||
print <<END
|
||||
<tr>
|
||||
<td>[$repository]</td>
|
||||
<td align='right'>$size</td>
|
||||
<td align='right'>$used</td>
|
||||
<td align='right'>$free</td>
|
||||
<td>
|
||||
END
|
||||
;
|
||||
&percentbar($percent);
|
||||
print <<END
|
||||
</td>
|
||||
<td align='right'>$percent</td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
}
|
||||
close DF;
|
||||
print "</table>\n";
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
|
||||
&Header::closepage();
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub check4updates
|
||||
{
|
||||
if ((-e "${General::swroot}/red/active") && (-e $sysupdflagfile) && (int(-M $sysupdflagfile) > 7))
|
||||
{
|
||||
my @response=();;
|
||||
|
||||
my $remote = IO::Socket::INET->new(
|
||||
PeerHost => 'www.advproxy.net',
|
||||
PeerPort => 'http(80)',
|
||||
Timeout => 1
|
||||
);
|
||||
|
||||
if ($remote)
|
||||
{
|
||||
print $remote "GET http://www.advproxy.net/update-accelerator/version/ipcop/latest HTTP/1.0\n";
|
||||
print $remote "User-Agent: Mozilla/4.0 (compatible; IPCop $General::version; $Lang::language; updatexlrator)\n\n";
|
||||
while (<$remote>) { push(@response,$_); }
|
||||
close $remote;
|
||||
if ($response[0] =~ /^HTTP\/\d+\.\d+\s200\sOK\s*$/)
|
||||
{
|
||||
system("touch $sysupdflagfile");
|
||||
return "$response[$#response]";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub savesettings
|
||||
{
|
||||
if (-e $chk_cron_dly) { unlink($chk_cron_dly); }
|
||||
if (-e $chk_cron_wly) { unlink($chk_cron_wly); }
|
||||
if (-e $chk_cron_mly) { unlink($chk_cron_mly); }
|
||||
|
||||
if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'daily'))
|
||||
{
|
||||
symlink("../bin/checkup",$chk_cron_dly)
|
||||
} else {
|
||||
symlink("/bin/false",$chk_cron_dly)
|
||||
}
|
||||
if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'weekly'))
|
||||
{
|
||||
symlink("../bin/checkup",$chk_cron_wly)
|
||||
} else {
|
||||
symlink("/bin/false",$chk_cron_wly)
|
||||
}
|
||||
if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'monthly'))
|
||||
{
|
||||
symlink("../bin/checkup",$chk_cron_mly)
|
||||
} else {
|
||||
symlink("/bin/false",$chk_cron_mly)
|
||||
}
|
||||
|
||||
delete($xlratorsettings{'REMOVE_OBSOLETE'});
|
||||
delete($xlratorsettings{'REMOVE_NOSOURCE'});
|
||||
delete($xlratorsettings{'REMOVE_OUTDATED'});
|
||||
|
||||
&General::writehash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub percentbar
|
||||
{
|
||||
my $percent = $_[0];
|
||||
my $fg = '#a0a0a0';
|
||||
my $bg = '#e2e2e2';
|
||||
|
||||
if ($percent =~ m/^(\d+)%$/ )
|
||||
{
|
||||
print <<END
|
||||
<table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
|
||||
<tr>
|
||||
END
|
||||
;
|
||||
if ($percent eq "100%") {
|
||||
print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
|
||||
} elsif ($percent eq "0%") {
|
||||
print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
|
||||
} else {
|
||||
print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
|
||||
}
|
||||
print <<END
|
||||
<img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
|
||||
END
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub getmtime
|
||||
{
|
||||
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_[0]);
|
||||
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
BIN
html/html/images/updxl-gr.gif
Normal file
|
After Width: | Height: | Size: 898 B |
BIN
html/html/images/updxl-led-blue.gif
Normal file
|
After Width: | Height: | Size: 158 B |
BIN
html/html/images/updxl-led-green.gif
Normal file
|
After Width: | Height: | Size: 898 B |
BIN
html/html/images/updxl-led-red.gif
Normal file
|
After Width: | Height: | Size: 898 B |
BIN
html/html/images/updxl-led-yellow.gif
Normal file
|
After Width: | Height: | Size: 158 B |
BIN
html/html/images/updxl-rd.gif
Normal file
|
After Width: | Height: | Size: 898 B |
BIN
html/html/images/updxl-src-adobe.gif
Normal file
|
After Width: | Height: | Size: 1000 B |
BIN
html/html/images/updxl-src-symantec.gif
Normal file
|
After Width: | Height: | Size: 1017 B |
BIN
html/html/images/updxl-src-unknown.gif
Normal file
|
After Width: | Height: | Size: 898 B |
BIN
html/html/images/updxl-src-windows.gif
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
html/html/images/updxl-yl.gif
Normal file
|
After Width: | Height: | Size: 158 B |
@@ -1543,6 +1543,54 @@
|
||||
'urlfilter update notification' => 'Update-Benachrichtigung!',
|
||||
'urlfilter update information' => 'Eine aktualisierte Version steht zum Download bereit. Besuchen Sie <a href="http://www.urlfilter.net" target="_blank">http://www.urlfilter.net</a> für weitere Informationen.',
|
||||
'urlfilter logs' => 'URL-Filter-Logdateien',
|
||||
'updxlrtr update accelerator' => 'Update-Accelerator',
|
||||
'updxlrtr configuration' => 'Update-Accelerator Konfiguration',
|
||||
'updxlrtr common settings' => 'Allgemeine Einstellungen',
|
||||
'updxlrtr enable log' => 'Aktiviere Protokoll',
|
||||
'updxlrtr children' => 'Anzahl der Accelerator-Prozesse',
|
||||
'updxlrtr passive mode' => 'Aktiviere Passiv-Modus',
|
||||
'updxlrtr max disk usage' => 'Max. Festplattennutzung',
|
||||
'updxlrtr low download priority' => 'Geringere CPU-Priorität für Downloads',
|
||||
'updxlrtr source checkup' => 'Quellenprüfung',
|
||||
'updxlrtr enable autocheck' => 'Aktiviere automatische Quellenprüfung',
|
||||
'updxlrtr source checkup schedule' => 'Zeitplanung der Quellenprüfung',
|
||||
'updxlrtr full autosync' => 'Ersetze veraltete Dateien während der Prüfung',
|
||||
'updxlrtr daily' => 'täglich',
|
||||
'updxlrtr weekly' => 'wöchentlich',
|
||||
'updxlrtr monthly' => 'monatlich',
|
||||
'updxlrtr maintenance' => 'Cache-Wartung',
|
||||
'updxlrtr purge' => 'Entferne',
|
||||
'updxlrtr all files' => 'alle Dateien ...',
|
||||
'updxlrtr marked as' => 'markiert als',
|
||||
'updxlrtr not accessed' => 'nicht zugegriffen seit',
|
||||
'updxlrtr week' => 'einer Woche',
|
||||
'updxlrtr month' => 'einem Monat',
|
||||
'updxlrtr 3 months' => 'drei Monaten',
|
||||
'updxlrtr 6 months' => 'sechs Monaten',
|
||||
'updxlrtr year' => 'einem Jahr',
|
||||
'updxlrtr save and restart' => 'Speichern und neu starten',
|
||||
'updxlrtr web proxy service required' => 'Der Web-Proxy muss aktiviert sein um den Update-Accelerator zu verwenden',
|
||||
'updxlrtr invalid num of children' => 'Ungültige Anzahl der Accelerator-Prozesse',
|
||||
'updxlrtr invalid disk usage' => 'Ungülter Wert für max. Festplattennutzung',
|
||||
'updxlrtr not enabled' => 'Der Update-Accelerator ist auf der Web-Proxy-Seite nicht aktiviert',
|
||||
'updxlrtr current files' => 'Aktuelle Dateien im lokalen Cache',
|
||||
'updxlrtr empty repository' => 'Der lokale Cache ist leer',
|
||||
'updxlrtr filename' => 'Name',
|
||||
'updxlrtr filesize' => 'Größe',
|
||||
'updxlrtr last access' => 'Letzer Cache-Zugriff',
|
||||
'updxlrtr last checkup' => 'Letzte Quellenprüfung',
|
||||
'updxlrtr source' => 'Quelle',
|
||||
'updxlrtr unknown' => 'Unbekannt',
|
||||
'updxlrtr disk usage' => 'Festplattennutzung',
|
||||
'updxlrtr cache dir' => 'Cache-Verzeichnis',
|
||||
'updxlrtr remove file' => 'Entferne vom Cache',
|
||||
'updxlrtr condition ok' => 'Aktuell',
|
||||
'updxlrtr condition nosource' => 'Keine Quelle',
|
||||
'updxlrtr condition outdated' => 'Nicht verifiziert / Veraltet',
|
||||
'updxlrtr condition download' => 'Beim Download',
|
||||
'updxlrtr update notification' => 'Update-Benachrichtigung!',
|
||||
'updxlrtr update information' => 'Eine aktualisierte Version steht zum Download bereit. Besuchen Sie <a href="http://www.advproxy.net/update-accelerator" target="_blank">http://www.advproxy.net/update-accelerator</a> für weitere Informationen.',
|
||||
|
||||
);
|
||||
|
||||
#EOF
|
||||
|
||||
@@ -1557,5 +1557,52 @@
|
||||
'ConnSched ipsecstart' => 'IPSec (re)start',
|
||||
'ConnSched ipsecstop' => 'IPSec stop',
|
||||
'theme' => 'Theme',
|
||||
'updxlrtr update accelerator' => 'Update Accelerator',
|
||||
'updxlrtr configuration' => 'Update Accelerator configuration',
|
||||
'updxlrtr common settings' => 'Common settings',
|
||||
'updxlrtr enable log' => 'Enable log',
|
||||
'updxlrtr children' => 'Number of accelerator processes',
|
||||
'updxlrtr passive mode' => 'Enable passive mode',
|
||||
'updxlrtr max disk usage' => 'Max. disk usage',
|
||||
'updxlrtr low download priority' => 'Lower CPU priority for downloads',
|
||||
'updxlrtr source checkup' => 'Source checkup',
|
||||
'updxlrtr enable autocheck' => 'Enable automatic source checkup',
|
||||
'updxlrtr source checkup schedule' => 'Source checkup schedule',
|
||||
'updxlrtr full autosync' => 'Replace outdated files during checkup',
|
||||
'updxlrtr daily' => 'daily',
|
||||
'updxlrtr weekly' => 'weekly',
|
||||
'updxlrtr monthly' => 'monthly',
|
||||
'updxlrtr maintenance' => 'Cache maintenance',
|
||||
'updxlrtr purge' => 'Purge',
|
||||
'updxlrtr all files' => 'all files ...',
|
||||
'updxlrtr marked as' => 'marked as',
|
||||
'updxlrtr not accessed' => 'not accessed since',
|
||||
'updxlrtr week' => 'one week',
|
||||
'updxlrtr month' => 'one month',
|
||||
'updxlrtr 3 months' => 'three months',
|
||||
'updxlrtr 6 months' => 'six months',
|
||||
'updxlrtr year' => 'one year',
|
||||
'updxlrtr save and restart' => 'Save and restart',
|
||||
'updxlrtr web proxy service required' => 'Web proxy service must be enabled to use Update Accelerator',
|
||||
'updxlrtr invalid num of children' => 'Invalid number of accelerator processes',
|
||||
'updxlrtr invalid disk usage' => 'Invalid value for max. disk usage',
|
||||
'updxlrtr not enabled' => 'Update Accelerator is not enabled on the Web proxy page',
|
||||
'updxlrtr current files' => 'Current files in local cache',
|
||||
'updxlrtr empty repository' => 'Local cache is empty',
|
||||
'updxlrtr filename' => 'Name',
|
||||
'updxlrtr filesize' => 'Size',
|
||||
'updxlrtr last access' => 'Last cache access',
|
||||
'updxlrtr last checkup' => 'Last source checkup',
|
||||
'updxlrtr source' => 'Source',
|
||||
'updxlrtr unknown' => 'Unknown',
|
||||
'updxlrtr disk usage' => 'Disk usage',
|
||||
'updxlrtr cache dir' => 'Cache directory',
|
||||
'updxlrtr remove file' => 'Remove from cache',
|
||||
'updxlrtr condition ok' => 'Up to date',
|
||||
'updxlrtr condition nosource' => 'No source',
|
||||
'updxlrtr condition outdated' => 'Not verified / Out of date',
|
||||
'updxlrtr condition download' => 'Downloading',
|
||||
'updxlrtr update notification' => 'Update notification!',
|
||||
'updxlrtr update information' => 'There is an updated version available for download. Visit <a href="http://www.advproxy.net" target="_blank">http://www.advproxy.net</a> for more information.',
|
||||
|
||||
);
|
||||
|
||||
@@ -86,7 +86,7 @@ ifeq "$(PASS)" "C"
|
||||
-find /etc/httpd/conf -name .svn -exec rm -rf {} \;
|
||||
|
||||
# Copy all html/cgi-bin files
|
||||
mkdir -p /srv/web/ipfire/{cgi-bin,html}
|
||||
mkdir -p /srv/web/ipfire/{cgi-bin,html/updatecache/{download,metadata}}
|
||||
cp -aR $(DIR_SRC)/html/* /srv/web/ipfire
|
||||
-find /srv/web/ipfire -name .svn -exec rm -rf {} \;
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ $(TARGET) :
|
||||
# Create all directories
|
||||
for i in addon-lang alcatelusb auth backup ca certs cnx_pci connscheduler crls ddns dhcp dhcpc dmzholes \
|
||||
eagle-usb eciadsl ethernet extrahd/bin isdn key langs logging main mbmon menu.d modem net-traffic nfs optionsfw outgoing/bin patches pakfire portfw \
|
||||
ppp private proxy/advanced qos/bin red remote snort time urlfilter/autoupdate urlfilter/bin upnp vpn wakeonlan wireless xtaccess ; do \
|
||||
ppp private proxy/advanced qos/bin red remote snort time updatexlrator/bin updatexlrator/autocheck urlfilter/autoupdate urlfilter/bin upnp vpn \
|
||||
wakeonlan wireless xtaccess ; do \
|
||||
mkdir -p $(CONFIG_ROOT)/$$i; \
|
||||
done
|
||||
|
||||
@@ -62,7 +63,7 @@ $(TARGET) :
|
||||
for i in auth/users backup/include.user backup/exclude.user \
|
||||
certs/index.txt ddns/config ddns/noipsettings ddns/settings ddns/ipcache dhcp/settings \
|
||||
dhcp/fixleases dhcp/advoptions dmzholes/config ethernet/aliases ethernet/settings \
|
||||
extrahd/scan extrahd/devices extrahd/partitions extrahd/settings
|
||||
extrahd/scan extrahd/devices extrahd/partitions extrahd/settings \
|
||||
isdn/settings main/hosts main/settings optionsfw/settings outgoing/settings outgoing/rules pakfire/settings \
|
||||
portfw/config ppp/settings-1 ppp/settings-2 ppp/settings-3 ppp/settings-4 \
|
||||
ppp/settings-5 ppp/settings proxy/settings proxy/advanced/settings remote/settings qos/settings qos/classes qos/subclasses qos/level7config qos/portconfig \
|
||||
|
||||
31
lfs/squid
@@ -26,7 +26,7 @@
|
||||
|
||||
include Config
|
||||
|
||||
VER = 2.6.STABLE3
|
||||
VER = 2.6.STABLE9
|
||||
|
||||
THISAPP = squid-$(VER)
|
||||
DL_FILE = $(THISAPP).tar.bz2
|
||||
@@ -42,7 +42,7 @@ objects = $(DL_FILE)
|
||||
|
||||
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
|
||||
|
||||
$(DL_FILE)_MD5 = 5b181e9c08f35d098e53e54b01fbd092
|
||||
$(DL_FILE)_MD5 = 95997d6cb38fdb562ecb790c553f9cfc
|
||||
|
||||
install : $(TARGET)
|
||||
|
||||
@@ -94,14 +94,33 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
cd $(DIR_APP) && make install
|
||||
|
||||
rm -f /etc/squid/squid.conf
|
||||
ln -sf $(CONFIG_ROOT)/proxy/squid.conf /etc/squid/squid.conf
|
||||
ln -sf /var/ipfire/proxy/squid.conf /etc/squid/squid.conf
|
||||
rm -f /etc/squid/errors
|
||||
ln -sf /usr/lib/squid/errors/English /etc/squid/errors
|
||||
|
||||
-mkdir -p /var/log/cache
|
||||
-mkdir -p /var/log/squid
|
||||
-mkdir -p /var/log/cache /var/log/squid /var/log/updatexlrator
|
||||
touch /var/log/squid/access.log
|
||||
chown -R squid:squid /var/log/squid /var/log/cache
|
||||
chown -R squid:squid /var/log/squid /var/log/cache /var/log/updatexlrator
|
||||
|
||||
cp -f $(DIR_SRC)/config/updxlrator/updxlrator /usr/sbin/updxlrator
|
||||
cp -f $(DIR_SRC)/config/updxlrator/checkup /var/ipfire/updatexlrator/bin/checkup
|
||||
cp -f $(DIR_SRC)/config/updxlrator/download /var/ipfire/updatexlrator/bin/download
|
||||
chmod 755 /usr/sbin/updxlrator /var/ipfire/updatexlrator/bin/checkup \
|
||||
/var/ipfire/updatexlrator/bin/download
|
||||
|
||||
ln -s /bin/false /var/ipfire/updatexlrator/autocheck/cron.daily
|
||||
ln -s /bin/false /var/ipfire/updatexlrator/autocheck/cron.monthly
|
||||
ln -s /bin/false /var/ipfire/updatexlrator/autocheck/cron.weekly
|
||||
|
||||
chown -R nobody:nobody /var/ipfire/updatexlrator
|
||||
chown nobody.squid /srv/web/ipfire/html/updatecache
|
||||
chown nobody.squid /srv/web/ipfire/html/updatecache/download
|
||||
chown nobody.squid /srv/web/ipfire/html/updatecache/metadata
|
||||
chmod 775 /srv/web/ipfire/html/updatecache
|
||||
chmod 775 /srv/web/ipfire/html/updatecache/download
|
||||
chmod 775 /srv/web/ipfire/html/updatecache/metadata
|
||||
chmod 755 /var/log/updatexlrator
|
||||
|
||||
|
||||
@rm -rf $(DIR_APP)
|
||||
@$(POSTBUILD)
|
||||
|
||||