summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-10-14 00:07:19 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-10-14 00:07:19 +0000
commitfdbd2f0907990c720505e4b3a1b18d1c470db7c8 (patch)
treef6c4a3e6f8e40918c1d3720b75a94f9841bcf4ea /scripts
parentd5aeb44bc4be804fb19a2d990e14b829c46cbc43 (diff)
downloadmtk-20170518-fdbd2f0907990c720505e4b3a1b18d1c470db7c8.zip
mtk-20170518-fdbd2f0907990c720505e4b3a1b18d1c470db7c8.tar.gz
mtk-20170518-fdbd2f0907990c720505e4b3a1b18d1c470db7c8.tar.bz2
fix download.pl for weird 'which' implementations
SVN-Revision: 5068
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/download.pl13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/download.pl b/scripts/download.pl
index f636cca..c29b5fe 100755
--- a/scripts/download.pl
+++ b/scripts/download.pl
@@ -18,8 +18,17 @@ my $ok;
@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;