summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-10-14 00:07:19 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-10-14 00:07:19 +0000
commit4665bf1d2c530e8db1d7a31721b1ebb33bacdf26 (patch)
tree044d2d6842ff018c10420bc5235ad44e1c5cc551 /scripts
parent92eb69df517b3fb651614975064d7ac14eaf1b8f (diff)
fix download.pl for weird 'which' implementations
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5068 3c298f89-4303-0410-b956-a3cf2f4a3e73
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 f636cca7eb..c29b5fe78e 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;