From: Harald Hoyer Date: Fri, 12 Aug 2011 11:22:17 +0000 (+0200) Subject: dracut-functions: use "type -P" for find_binary() X-Git-Tag: 013~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1610a566c6afbaac5ea1e9547c847f1aefd8a56c;p=thirdparty%2Fdracut.git dracut-functions: use "type -P" for find_binary() --- diff --git a/dracut-functions b/dracut-functions index 6c29170db..b4e1240bd 100755 --- a/dracut-functions +++ b/dracut-functions @@ -378,17 +378,14 @@ inst_library() { # find a binary. If we were not passed the full path directly, # search in the usual places to find the binary. find_binary() { - local _binpath="/usr/sbin /sbin /usr/bin /bin" _p if [[ -z ${1##/*} ]]; then if [[ -x $1 ]] || ldd $1 &>/dev/null; then echo $1 return 0 fi fi - for _p in $_binpath; do - [[ -x $_p/$1 ]] && { echo "$_p/$1"; return 0; } - done - return 1 + + PATH="/usr/sbin:/sbin:/usr/bin:/bin" type -P $1 } # Same as above, but specialized to install binary executables.