Browse Source

Rename find_file to find_binary and simplify it.

Since we are not using find_file as a general-purpose file existence
testing function anymore, it can be made simpler.
master
Victor Lowther 16 years ago
parent
commit
6b25d71acd
  1. 21
      dracut-functions

21
dracut-functions

@ -54,32 +54,21 @@ inst_library() { @@ -54,32 +54,21 @@ inst_library() {
fi
}
find_file() {
local binpath="/bin /sbin /usr/bin /usr/sbin" p

#Full path or not?
if [[ ${1##*/} != $1 ]] ; then
if [[ -e $1 ]] ; then
echo $1;
return 0;
fi
return 1;
fi
#Search in path
find_binary() {
local binpath="/bin /sbin /usr/bin /usr/sbin" p
[[ -x $1 ]] && { echo $1; return 0; }
for p in $binpath; do
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
[[ -e $p/$1 ]] && { echo "$p/$1"; return 0; }
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
done
return 1
}


# Same as above.
# If the file is a binary executable, install all its
# shared library dependencies, if any.
inst_binary() {
local bin target
bin=$(find_file "$1") || return 1
bin=$(find_binary "$1") || return 1
shift
local LDSO NAME IO FILE ADDR I1 n f TLIBDIR
[[ -f $initdir$target ]] && return 0

Loading…
Cancel
Save