projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ensure dropbear is installed before disabling telnet (#920)
[openwrt.git]
/
scripts
/
download.pl
diff --git
a/scripts/download.pl
b/scripts/download.pl
index
f636cca
..
8f5d1d6
100755
(executable)
--- a/
scripts/download.pl
+++ b/
scripts/download.pl
@@
-18,16
+18,27
@@
my $ok;
@ARGV > 0 or die "Syntax: $0 <target dir> <filename> <md5sum> <mirror> [<mirror> ...]\n";
@ARGV > 0 or die "Syntax: $0 <target dir> <filename> <md5sum> <mirror> [<mirror> ...]\n";
-my $md5cmd = `which md5sum`;
-$md5cmd or $md5cmd = `which md5`;
+sub which($) {
+ my $prog = shift;
+ my $res = `which $prog`;
+ $res or return undef;
+ $res =~ /^no / and return undef;
+ $res =~ /not found/ and return undef;
+ return $res;
+}
+
+my $md5cmd = which("md5sum");
+$md5cmd or $md5cmd = which("md5");
$md5cmd or die 'no md5 checksum program found, please install md5 or md5sum';
chomp $md5cmd;
sub download
{
my $mirror = shift;
$md5cmd or die 'no md5 checksum program found, please install md5 or md5sum';
chomp $md5cmd;
sub download
{
my $mirror = shift;
+ my $options = $ENV{WGET_OPTIONS};
+ $options or $options = "";
- open WGET, "wget -t1 --timeout=20 -O- \"$mirror/$filename\" |" or die "Cannot launch wget.\n";
+ open WGET, "wget -t1 --timeout=20
$options
-O- \"$mirror/$filename\" |" or die "Cannot launch wget.\n";
open MD5SUM, "| $md5cmd > \"$target/$filename.md5sum\"" or die "Cannot launch md5sum.\n";
open OUTPUT, "> $target/$filename.dl" or die "Cannot create file $target/$filename.dl: $!\n";
my $buffer;
open MD5SUM, "| $md5cmd > \"$target/$filename.md5sum\"" or die "Cannot launch md5sum.\n";
open OUTPUT, "> $target/$filename.dl" or die "Cannot create file $target/$filename.dl: $!\n";
my $buffer;
This page took
0.029695 seconds
and
4
git commands to generate.