]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Rename find_file to find_binary and simplify it.
authorVictor Lowther <victor.lowther@gmail.com>
Fri, 6 Mar 2009 19:56:06 +0000 (13:56 -0600)
committerVictor Lowther <victor.lowther@gmail.com>
Fri, 6 Mar 2009 19:56:06 +0000 (13:56 -0600)
Since we are not using find_file as a general-purpose file existence
testing function anymore, it can be made simpler.

dracut-functions

index 1a2d28c98669d8343979ebdc17434996e13a1707..2556db379400216896c2cda4f9d77a2e604d4726 100755 (executable)
@@ -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