From: Victor Lowther Date: Fri, 6 Mar 2009 19:56:06 +0000 (-0600) Subject: Rename find_file to find_binary and simplify it. X-Git-Tag: 0.1~333 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b25d71acd12a37ece595ac26d89e3ff1b0f0892;p=thirdparty%2Fdracut.git 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. --- diff --git a/dracut-functions b/dracut-functions index 1a2d28c98..2556db379 100755 --- a/dracut-functions +++ b/dracut-functions @@ -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