dracut-functions: use "type -P" for find_binary()

master
Harald Hoyer 2011-08-12 13:22:17 +02:00
parent 7ef8ff9a2e
commit 1610a566c6
1 changed files with 2 additions and 5 deletions

View File

@ -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.