]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - config/updxlrator/updxlrator
update accelerator: Do not attempt to cache IPFire updates any more
[people/pmueller/ipfire-2.x.git] / config / updxlrator / updxlrator
index 2ddc6d8e4425d133d2673c7bc913949723d23970..cdc7eeb503589af0bd350910dd56e30f4ed9520b 100644 (file)
@@ -86,6 +86,8 @@ while (<>) {
        &&   ($source_url !~ m@\&@)
           )
        {
+               # NOTE: check_cache will change to $mirror instead of $unique if the filename contains an SHA1 hash
+               # and the URL is not found in cache!
                $xlrator_url = &check_cache($source_url,$hostaddr,$username,"Microsoft",$unique);
        }
 
@@ -95,8 +97,8 @@ while (<>) {
 
 
        if (
-           ($source_url =~ m@^http://(ar)?download\.adobe\.com/.*\.(exe|msi|bin|dmg|idx|gz)$@i) ||
-           ($source_url =~ m@^http://swupdl\.adobe\.com/updates/.*\.(exe|msi|bin|dmg|idx|gz|[a-z][a-z]_[A-Z][A-Z])$@i) ||
+           ($source_url =~ m@^http://(ar)?download\.adobe\.com/.*\.(exe|ms[ip]|bin|dmg|idx|gz)$@i) ||
+           ($source_url =~ m@^http://swupdl\.adobe\.com/updates/.*\.(exe|ms[ip]|bin|dmg|idx|gz|[a-z][a-z]_[A-Z][A-Z])$@i) ||
            ($source_url =~ m@^http://swupmf\.adobe\.com/manifest/.*\.upd$@i)
           )
        {
@@ -191,15 +193,6 @@ while (<>) {
                $xlrator_url = &check_cache($source_url,$hostaddr,$username,"Avira",$mirror);
        }
 
-       # -----------------------------------------------------------
-       # Section: IPFire Downloads
-       # -----------------------------------------------------------
-
-       if ($source_url =~ m@^[f|h]t?tp://.*\.(ipfire)$@i)
-       {
-               $xlrator_url = &check_cache($source_url,$hostaddr,$username,"IPFire",$mirror);
-       }
-
        # -----------------------------------------------------------
        # Section: AVG Downloads
        # -----------------------------------------------------------
@@ -345,7 +338,9 @@ sub check_cache
        my $sourceurl=$_[0];
        my $cfmirror=$_[4];
 
+       $sourceurl =~ s@\%2b@+@ig;
        $sourceurl =~ s@\%2f@/@ig;
+       $sourceurl =~ s@\%7e@~@ig;
        $updfile = substr($sourceurl,rindex($sourceurl,"/")+1);
        $updfile =~ s@\%20@ @ig;
 
@@ -395,9 +390,20 @@ sub check_cache
           )
        {
                &debuglog("File exists in cache and is up to date");
-               &debuglog("Retrieving file from cache ($updsource)");
+               &debuglog("Retrieving file from cache ($updsource) for $hostaddr");
                &setcachestatus("$updcachedir/$vendorid/$uuid/access.log",time);
                $cacheurl="http://$netsettings{'GREEN_ADDRESS'}:$http_port/updatecache/$vendorid/$uuid/$updfile";
+       }
+       elsif (
+               ($cfmirror == $unique) &&
+               ($vendorid == "microsoft") &&
+               ($source_url =~ m@.*[0-9a-f]{40}\.[^\.]+@i)
+             )
+       {
+                       # Most Microsoft updates now have an SHA1 hash in the name. These should be treated as unique files.
+                       # Since it wasn't found in the URL cache, switch to mirror mode and try again using just the filename.
+                       &debuglog("SHA1: $vendorid $uuid not cached. Reprocessing as mirror $sourceurl");
+                       $cacheurl = &check_cache($source_url,$hostaddr,$username,$vendorid,$mirror);
        }
                else
        {
@@ -412,7 +418,7 @@ sub check_cache
                &debuglog("Free disk space: " . &diskfree($updcachedir));
                &debuglog("Disk usage: " . &diskusage($updcachedir) . "% (max. $maxusage%)");
                if (-e "$updcachedir/download/$vendorid/$updfile") { &debuglog("File download/$vendorid/$updfile exists"); }
-               &debuglog("Retrieving file from source ($updsource)");
+               &debuglog("Retrieving file from source ($updsource) for $hostaddr");
                if ((!$passive_mode) && (&diskusage($updcachedir) <= $maxusage) && ($remote_size <= &diskfree($updcachedir)) && (!-e "$updcachedir/download/$vendorid/$updfile"))
                {
                        &debuglog("Running command $nice$apphome/bin/download $vendorid $sourceurl $cfmirror &");