dracut-functions: use "type -P" for find_binary()
authorHarald Hoyer <harald@redhat.com>
Fri, 12 Aug 2011 11:22:17 +0000 (13:22 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 12 Aug 2011 11:22:17 +0000 (13:22 +0200)
dracut-functions

index 6c29170dbf06efa7fecb6c7812e309a654052249..b4e1240bd81f8f0dc5fb4e7a200124103c41882f 100755 (executable)
@@ -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.