mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 03:33:25 +02:00
Finaly the Updbooster should work now
This commit is contained in:
@@ -18,7 +18,6 @@ my $repository='/var/updatecache';
|
|||||||
my $login='';
|
my $login='';
|
||||||
my $dlrate='';
|
my $dlrate='';
|
||||||
my $uuid='';
|
my $uuid='';
|
||||||
my $wget="$apphome/bin/wget";
|
|
||||||
my $useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
|
my $useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
|
||||||
my %xlratorsettings=();
|
my %xlratorsettings=();
|
||||||
my %proxysettings=();
|
my %proxysettings=();
|
||||||
@@ -44,8 +43,9 @@ $vendorid =~ tr/A-Z/a-z/;
|
|||||||
|
|
||||||
unless (-d "$repository/download/$vendorid")
|
unless (-d "$repository/download/$vendorid")
|
||||||
{
|
{
|
||||||
system("mkdir $repository/download/$vendorid");
|
system("mkdir -p $repository/download/$vendorid");
|
||||||
system("$apphome/bin/setperms download/$vendorid");
|
system("chown -R nobody.squid $repository/download/$vendorid");
|
||||||
|
system("chmod 775 $repository/download/$vendorid");
|
||||||
}
|
}
|
||||||
|
|
||||||
exit if (-e "$repository/download/$vendorid/$updatefile");
|
exit if (-e "$repository/download/$vendorid/$updatefile");
|
||||||
@@ -94,7 +94,7 @@ if ($xlratorsettings{'MAX_DOWNLOAD_RATE'} eq '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
||||||
@http_header = `$wget $login --user-agent="$useragent" --spider -S $sourceurl 2>&1`;
|
@http_header = `wget $login --user-agent="$useragent" --spider -S $sourceurl 2>&1`;
|
||||||
$ENV{'http_proxy'} = '';
|
$ENV{'http_proxy'} = '';
|
||||||
|
|
||||||
foreach (@http_header)
|
foreach (@http_header)
|
||||||
@@ -106,7 +106,7 @@ foreach (@http_header)
|
|||||||
|
|
||||||
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
$ENV{'http_proxy'} = $proxysettings{'UPSTREAM_PROXY'};
|
||||||
unlink "$repository/download/$vendorid/$updatefile";
|
unlink "$repository/download/$vendorid/$updatefile";
|
||||||
$_ = system("$wget $login $dlrate --user-agent=\"$useragent\" -q -nc -P $repository/download/$vendorid $sourceurl");
|
$_ = system("wget $login $dlrate --user-agent=\"$useragent\" -q -nc -P $repository/download/$vendorid $sourceurl");
|
||||||
$ENV{'http_proxy'} = '';
|
$ENV{'http_proxy'} = '';
|
||||||
|
|
||||||
if ($_ == 0)
|
if ($_ == 0)
|
||||||
@@ -115,14 +115,16 @@ if ($_ == 0)
|
|||||||
|
|
||||||
unless (-d "$repository/$vendorid")
|
unless (-d "$repository/$vendorid")
|
||||||
{
|
{
|
||||||
system("mkdir $repository/$vendorid");
|
system("mkdir -p $repository/$vendorid");
|
||||||
system("$apphome/bin/setperms $vendorid");
|
system("chown -R nobody.squid $repository/$vendorid");
|
||||||
|
system("chmod 775 $repository/$vendorid");
|
||||||
}
|
}
|
||||||
|
|
||||||
unless (-d "$repository/$vendorid/$uuid")
|
unless (-d "$repository/$vendorid/$uuid")
|
||||||
{
|
{
|
||||||
system("mkdir $repository/$vendorid/$uuid");
|
system("mkdir -p $repository/$vendorid/$uuid");
|
||||||
system("$apphome/bin/setperms $vendorid/$uuid");
|
system("chown -R nobody.squid $repository/$vendorid/$uuid");
|
||||||
|
system("chmod 775 $repository/$vendorid/$uuid");
|
||||||
}
|
}
|
||||||
|
|
||||||
&writelog("Moving file to the cache directory: $vendorid/$uuid");
|
&writelog("Moving file to the cache directory: $vendorid/$uuid");
|
||||||
@@ -137,7 +139,8 @@ if ($_ == 0)
|
|||||||
&setcachestatus("$repository/$vendorid/$uuid/checkup.log",time);
|
&setcachestatus("$repository/$vendorid/$uuid/checkup.log",time);
|
||||||
&setcachestatus("$repository/$vendorid/$uuid/access.log",time);
|
&setcachestatus("$repository/$vendorid/$uuid/access.log",time);
|
||||||
|
|
||||||
system("$apphome/bin/setperms $vendorid/$uuid/*");
|
system("chown -R nobody.squid $repository/$vendorid/$uuid/*");
|
||||||
|
system("chmod 775 $repository/$vendorid/$uuid/*");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
&writelog("Download finished with result code: ERROR");
|
&writelog("Download finished with result code: ERROR");
|
||||||
@@ -180,7 +183,7 @@ sub readhash
|
|||||||
sub writelog
|
sub writelog
|
||||||
{
|
{
|
||||||
if ($logging)
|
if ($logging)
|
||||||
{
|
{
|
||||||
open (LOGFILE,">>$logfile");
|
open (LOGFILE,">>$logfile");
|
||||||
my @now = localtime(time);
|
my @now = localtime(time);
|
||||||
printf LOGFILE "%04d-%02d-%02d %02d:%02d:%02d [%d] %s\n",$now[5]+1900,$now[4]+1,$now[3],$now[2],$now[1],$now[0],$$,$_[0];
|
printf LOGFILE "%04d-%02d-%02d %02d:%02d:%02d [%d] %s\n",$now[5]+1900,$now[4]+1,$now[3],$now[2],$now[1],$now[0],$$,$_[0];
|
||||||
|
|||||||
Binary file not shown.
@@ -361,7 +361,7 @@ sub check_cache
|
|||||||
&debuglog("File exists in cache and is up to date");
|
&debuglog("File exists in cache and is up to date");
|
||||||
&debuglog("Retrieving file from cache ($updsource)");
|
&debuglog("Retrieving file from cache ($updsource)");
|
||||||
&setcachestatus("$updcachedir/$vendorid/$uuid/access.log",time);
|
&setcachestatus("$updcachedir/$vendorid/$uuid/access.log",time);
|
||||||
system("$apphome/bin/setperms $vendorid/$uuid/access.log");
|
system("chown nobody.squid $vendorid/$uuid/access.log");
|
||||||
$cacheurl="http://$netsettings{'GREEN_ADDRESS'}:$http_port/updatecache/$vendorid/$uuid/$updfile";
|
$cacheurl="http://$netsettings{'GREEN_ADDRESS'}:$http_port/updatecache/$vendorid/$uuid/$updfile";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user