Bug 11558

Summary: updxlrator - huge windows 10 downloads duplicated coming from different mirrors
Product: IPFire Reporter: jluth
Component: ---Assignee: jluth
Status: CLOSED FIXED QA Contact:
Severity: - Unknown -    
Priority: - Unknown - CC: bbitsch, jluth, michael.tremer, peter.mueller
Version: 2   
Hardware: unspecified   
OS: Unspecified   
See Also: https://bugzilla.ipfire.org/show_bug.cgi?id=11567
Bug Depends on: 10504    
Bug Blocks:    
Attachments: use_sha_name.sh: script to link the filename-md5sum folder to the existing url-md5sum folder

Description jluth 2017-12-06 09:47:36 UTC
Created attachment 546 [details]
use_sha_name.sh: script to link the filename-md5sum folder to the existing url-md5sum folder

Microsoft downloads are cached based on the URL ($unique) rather than on the filename ($mirror). However, most downloads now contain an SHA1 hash in the filename. Windows Update on Windows 10 has proven to attempt to download the huge (6+GB/month) updates from multiple URLs, so that 6GB is multiplied by each mirror that is hit.

The filename switch can easily be made with:
if ( $source_url =~ m@.*[0-9a-f]{40}\.[^\.]+@i ) {
$xlrator_url = &check_cache($source_url,$hostaddr,$username,"Microsoft",$mirror);
} else {
$xlrator_url = &check_cache($source_url,$hostaddr,$username,"Microsoft",$unique);
}

Of course, only doing that means that everything gets downloaded yet again.  However, a cleanup script could rename the existing url-based-folder to be a filename-based-folder.

NOTE: I did this via a symbolic link (scripted attached), but then I also had to allow SymLinks in apache. The script needs the helper file md5name.pl
-----------md5name.pl----------
#!/usr/bin/perl
        $sourceurl=shift;
        $sourceurl =~ s@\%2b@+@ig;
        $sourceurl =~ s@\%2f@/@ig;
        $sourceurl =~ s@\%7e@~@ig;
        $uuid = `echo $sourceurl | md5sum`;
        $uuid =~ s/[^0-9a-f]//g;
        $uuid =~ s/([a-f\d]{8})([a-f\d]{4})([a-f\d]{4})([a-f\d]{4})([a-f\d]{12})/$1-$2-$3-$4-$5/;
print $uuid;
exit 0;
------------------------------
Comment 2 Michael Tremer 2018-01-29 12:15:35 UTC
About to be released with c118
Comment 3 Peter Müller 2018-04-09 19:29:15 UTC
Core Update has been released, fixed.