From 6b25d71acd12a37ece595ac26d89e3ff1b0f0892 Mon Sep 17 00:00:00 2001 From: Victor Lowther Date: Fri, 6 Mar 2009 13:56:06 -0600 Subject: [PATCH] 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. --- dracut-functions | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/dracut-functions b/dracut-functions index 1a2d28c9..2556db37 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