From: Felix Fietkau Date: Sat, 14 Oct 2006 00:07:19 +0000 (+0000) Subject: fix download.pl for weird 'which' implementations X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fdbd2f0907990c720505e4b3a1b18d1c470db7c8;p=openwrt%2Fstaging%2Fneocturne.git fix download.pl for weird 'which' implementations SVN-Revision: 5068 --- 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 [ ...]\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;