scripts/download.pl: fix mirrors regression for curl and wget
authorChristian Marangi <ansuelsmth@gmail.com>
Sun, 25 Sep 2022 19:43:43 +0000 (21:43 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Mon, 26 Sep 2022 18:50:09 +0000 (20:50 +0200)
With the introduction of aria2c support, curl and wget no longer try to
download the file from mirrors. Fix this regression by emptying the
remaining mirrors list only when aria2c is used.

Fixes: d39123626931 ("download.pl: add aria2c support")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
scripts/download.pl

index 50dca2335ea2fc99ceb9eb55cb81823bc990281d..51a816cff440cf9369de34539dba1072f0111cb1 100755 (executable)
@@ -93,6 +93,7 @@ sub download_cmd {
        }
 
        if ($have_aria2c) {
+               @mirrors=();
                return join(" ", "touch /dev/shm/${rfn}_spp;",
                        qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $url, $additional_mirrors,
                        $check_certificate ? () : '--check-certificate=false',
@@ -321,7 +322,6 @@ while (!-f "$target/$filename") {
        if (!-f "$target/$filename" && $url_filename ne $filename) {
                download($mirror, $filename, @mirrors);
        }
-       @mirrors=();
 }
 
 $SIG{INT} = \&cleanup;