diff options
author | Christian Marangi <ansuelsmth@gmail.com> | 2022-09-25 15:54:12 +0200 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2022-09-25 15:54:12 +0200 |
commit | 295e0ed7a9fee59c1bb6dd80179109c634578425 (patch) | |
tree | 76bde3213deeca681edd1bb8a16db555c4643bcd | |
parent | d08c9da43cf364712e947d5faa3ab84d995dd0ec (diff) | |
download | openwrt-295e0ed7a9fee59c1bb6dd80179109c634578425.tar.gz openwrt-295e0ed7a9fee59c1bb6dd80179109c634578425.tar.bz2 openwrt-295e0ed7a9fee59c1bb6dd80179109c634578425.zip |
scripts/download.pl: fix whitespace in mirror urls and drop for
Fix whitespace in mirror urls and replace for loop with join+map logic.
Fixes: d39123626931 ("download.pl: add aria2c support")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rwxr-xr-x | scripts/download.pl | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/scripts/download.pl b/scripts/download.pl index 4dec985fd1..50dca2335e 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -75,8 +75,7 @@ sub download_cmd { my $have_curl = 0; my $have_aria2c = 0; my $filename = shift; - my @additional_mirrors = @_; - my $mirrors_url = "'$url'"; + my $additional_mirrors = join(" ", map "$_/$filename", @_); my @chArray = ('a'..'z', 'A'..'Z', 0..9); my $rfn = join '', map{ $chArray[int rand @chArray] } 0..9; @@ -93,13 +92,9 @@ sub download_cmd { close ARIA2C; } - for my $mirror (@additional_mirrors ) { - $mirrors_url = $mirrors_url ." '$mirror /$filename'"; - } - if ($have_aria2c) { return join(" ", "touch /dev/shm/${rfn}_spp;", - qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $mirrors_url , + qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $url, $additional_mirrors, $check_certificate ? () : '--check-certificate=false', "--server-stat-of=/dev/shm/${rfn}_spp", "--server-stat-if=/dev/shm/${rfn}_spp", |