From: ms Date: Thu, 15 Feb 2007 21:26:14 +0000 (+0000) Subject: Updatexlrator (not tested yet) X-Git-Tag: v2.3-beta1~834 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=46c01c0912ff4e3c16c90b569991e6989e27436f Updatexlrator (not tested yet) git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@421 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/cron/crontab b/config/cron/crontab index 88e40b5d83..d24ec5dc3a 100644 --- a/config/cron/crontab +++ b/config/cron/crontab @@ -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 diff --git a/config/etc/logrotate.conf b/config/etc/logrotate.conf index 3b29695074..0f171d6448 100644 --- a/config/etc/logrotate.conf +++ b/config/etc/logrotate.conf @@ -82,3 +82,12 @@ compress notifempty missingok } + +/var/log/updatexlrator/*.log { + weekly + rotate 4 + copytruncate + compress + notifempty + missingok +} diff --git a/config/updxlrator/checkup b/config/updxlrator/checkup new file mode 100644 index 0000000000..fc353f4431 --- /dev/null +++ b/config/updxlrator/checkup @@ -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 = ; + 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 () + { + 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; +} + +# ------------------------------------------------------------------- diff --git a/config/updxlrator/download b/config/updxlrator/download new file mode 100644 index 0000000000..cc187f5e8d --- /dev/null +++ b/config/updxlrator/download @@ -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 = ; +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; +} + +# =============================================================== diff --git a/config/updxlrator/updxlrator b/config/updxlrator/updxlrator new file mode 100644 index 0000000000..4f54d429e3 --- /dev/null +++ b/config/updxlrator/updxlrator @@ -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 () + { + 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() + { + 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() + { + 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; +} + +# ------------------------------------------------------------------- diff --git a/html/cgi-bin/updatexlrator.cgi b/html/cgi-bin/updatexlrator.cgi new file mode 100644 index 0000000000..529061bf6a --- /dev/null +++ b/html/cgi-bin/updatexlrator.cgi @@ -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 = ; + 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 "$errormessage \n"; + &Header::closebox(); +} + +if (($updxlratorversion lt $latest) && (-e $sysupdflagfile)) { unlink($sysupdflagfile); } + +if (!-e $sysupdflagfile) { + &Header::openbox('100%', 'left', $Lang::tr{'updxlrtr update notification'}); + print "\n"; + print "\n"; + print ""; + print "\n"; + print "
$Lang::tr{'updxlrtr update information'}
\n"; + &Header::closebox(); +} + +print "
\n"; + +&Header::openbox('100%', 'left', "$Lang::tr{'updxlrtr update accelerator'}"); + +print < + + $Lang::tr{'updxlrtr common settings'} + + + $Lang::tr{'updxlrtr enable log'}: + + $Lang::tr{'updxlrtr children'}: + + + + $Lang::tr{'updxlrtr passive mode'}: + + $Lang::tr{'updxlrtr max disk usage'}: + % + + + $Lang::tr{'updxlrtr low download priority'}: + +   +   + + +
+ + + + + + + + + + + + + + + + +
$Lang::tr{'updxlrtr source checkup'}
$Lang::tr{'updxlrtr enable autocheck'}:$Lang::tr{'updxlrtr source checkup schedule'}: + +
$Lang::tr{'updxlrtr full autosync'}:  
+
+ + + + + + + + + + + + + + + + + + + +
$Lang::tr{'updxlrtr maintenance'}
 $Lang::tr{'updxlrtr all files'} $Lang::tr{'updxlrtr not accessed'} +
 $Lang::tr{'updxlrtr marked as'}$Lang::tr{[$Lang::tr{'updxlrtr condition nosource'}] $Lang::tr{'updxlrtr marked as'}$Lang::tr{[$Lang::tr{'updxlrtr condition outdated'}]
+
+ + + + + + + +
  
+ + + + +
+ Update Accelerator $updxlratorversion +
+END +; + +&Header::closebox(); + +print "\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 < + + + + + +   +   + $Lang::tr{'updxlrtr filename'} + $Lang::tr{'updxlrtr filesize'} + $Lang::tr{'date'} + $Lang::tr{ + $Lang::tr{ +   + +END +; + $id = 0; + foreach $updatefile (@repositoryfiles) + { + $id++; + if ($id % 2) { + print "\n"; } + else { + print "\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 = ; + 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 "; + if ($metadata[2] eq $sfNoSource) + { + print "$Lang::tr{ \n"; + } + if ($metadata[2] eq $sfOk) + { + print "$Lang::tr{ \n"; + } + if (($metadata[2] eq $sfOutdated) && (!($updatefile =~ /^download\//i))) + { + print "$Lang::tr{ \n"; + } + if (($metadata[2] eq $sfOutdated) && ($updatefile =~ /^download\//i)) + { + print "$Lang::tr{ \n"; + } + if ($metadata[2] eq '') + { + print "$Lang::tr{ \n"; + } + + print "\t\t "; + if ($metadata[1] eq 'Adobe') + { + print "Adobe \n"; + } elsif ($metadata[1] eq 'Microsoft') + { + print "Microsoft \n"; + } elsif ($metadata[1] eq 'Symantec') + { + print "Symantec \n"; + } else + { + print "$Lang::tr{ \n"; + } + + $shortname = $updatefile; + $shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/\1_*\2/i; + $shortname =~ s/^download\///i; + +print <$shortname +  $filesize  +  $filedate  +  $lastaccess  +  $lastcheck  + +
+ + + +
+ + +END +; + } + +print < +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  $Lang::tr{'legend'}: $Lang::tr{$Lang::tr{'updxlrtr last access'} $Lang::tr{$Lang::tr{'updxlrtr last checkup'} $Lang::tr{$Lang::tr{'updxlrtr remove file'}   
  $Lang::tr{'status'}: $Lang::tr{$Lang::tr{'updxlrtr condition ok'} $Lang::tr{$Lang::tr{'updxlrtr condition nosource'} $Lang::tr{$Lang::tr{'updxlrtr condition outdated'} $Lang::tr{$Lang::tr{'updxlrtr condition download'}
  $Lang::tr{'updxlrtr source'}: AdobeAdobe MicrosoftMicrosoft SymantecSymantec $Lang::tr{$Lang::tr{'updxlrtr unknown'}
+END +; +} else { + + print "$Lang::tr{'updxlrtr empty repository'}\n"; +} + +print < + + + +
$Lang::tr{'updxlrtr disk usage'}:
+ + +END +; +open(DF,"/bin/df -h $repository|"); +while() +{ + if ($_ =~ m/^Filesystem/ ) + { + print < + + + + + + +END +; + } + else + { + my ($device,$size,$used,$free,$percent,$mount) = split; + print < + + + + + + +END +; + } +} +close DF; +print "
$Lang::tr{'updxlrtr cache dir'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage'}
[$repository]$size$used$free +END +; + &percentbar($percent); + print < +$percent
\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 +; + if ($percent eq "100%") { + print "" + } elsif ($percent eq "0%") { + print "" + } else { + print "" + } + print < +END +; + } +} + +# ------------------------------------------------------------------- + +sub getmtime +{ + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_[0]); + + return $mtime; +} + +# ------------------------------------------------------------------- diff --git a/html/html/images/updxl-gr.gif b/html/html/images/updxl-gr.gif new file mode 100644 index 0000000000..f8b8ec07bf Binary files /dev/null and b/html/html/images/updxl-gr.gif differ diff --git a/html/html/images/updxl-led-blue.gif b/html/html/images/updxl-led-blue.gif new file mode 100644 index 0000000000..80424c9318 Binary files /dev/null and b/html/html/images/updxl-led-blue.gif differ diff --git a/html/html/images/updxl-led-green.gif b/html/html/images/updxl-led-green.gif new file mode 100644 index 0000000000..f8b8ec07bf Binary files /dev/null and b/html/html/images/updxl-led-green.gif differ diff --git a/html/html/images/updxl-led-red.gif b/html/html/images/updxl-led-red.gif new file mode 100644 index 0000000000..4bce21f241 Binary files /dev/null and b/html/html/images/updxl-led-red.gif differ diff --git a/html/html/images/updxl-led-yellow.gif b/html/html/images/updxl-led-yellow.gif new file mode 100644 index 0000000000..f7e4f9ab5b Binary files /dev/null and b/html/html/images/updxl-led-yellow.gif differ diff --git a/html/html/images/updxl-rd.gif b/html/html/images/updxl-rd.gif new file mode 100644 index 0000000000..4bce21f241 Binary files /dev/null and b/html/html/images/updxl-rd.gif differ diff --git a/html/html/images/updxl-src-adobe.gif b/html/html/images/updxl-src-adobe.gif new file mode 100644 index 0000000000..ebcd551aa4 Binary files /dev/null and b/html/html/images/updxl-src-adobe.gif differ diff --git a/html/html/images/updxl-src-symantec.gif b/html/html/images/updxl-src-symantec.gif new file mode 100644 index 0000000000..14fda71a07 Binary files /dev/null and b/html/html/images/updxl-src-symantec.gif differ diff --git a/html/html/images/updxl-src-unknown.gif b/html/html/images/updxl-src-unknown.gif new file mode 100644 index 0000000000..d95eeb551e Binary files /dev/null and b/html/html/images/updxl-src-unknown.gif differ diff --git a/html/html/images/updxl-src-windows.gif b/html/html/images/updxl-src-windows.gif new file mode 100644 index 0000000000..ab593e1563 Binary files /dev/null and b/html/html/images/updxl-src-windows.gif differ diff --git a/html/html/images/updxl-yl.gif b/html/html/images/updxl-yl.gif new file mode 100644 index 0000000000..f7e4f9ab5b Binary files /dev/null and b/html/html/images/updxl-yl.gif differ diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 7baef61e2f..de17b53d26 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -1543,6 +1543,54 @@ 'urlfilter update notification' => 'Update-Benachrichtigung!', 'urlfilter update information' => 'Eine aktualisierte Version steht zum Download bereit. Besuchen Sie http://www.urlfilter.net 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 http://www.advproxy.net/update-accelerator für weitere Informationen.', + ); #EOF diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 5d2c4d0df1..9a0433a664 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -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 http://www.advproxy.net for more information.', ); diff --git a/lfs/apache2 b/lfs/apache2 index cc2e3be6a4..73baa80ade 100644 --- a/lfs/apache2 +++ b/lfs/apache2 @@ -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 {} \; diff --git a/lfs/configroot b/lfs/configroot index 9e0da0b002..6be94cf3f4 100644 --- a/lfs/configroot +++ b/lfs/configroot @@ -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 \ diff --git a/lfs/squid b/lfs/squid index 3db063e135..2810dd15c7 100644 --- a/lfs/squid +++ b/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)