]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
- add search paths to find_tool() so it will fall back to standard,
authorJan Rękorajski <baggins@pld-linux.org>
Thu, 5 Jul 2012 09:54:20 +0000 (09:54 +0000)
committerJan Rękorajski <baggins@pld-linux.org>
Thu, 5 Jul 2012 09:54:20 +0000 (09:54 +0000)
  dynamically linked programs if those specified at command invocation
  cannot be found

svn-id: @12573

geninitrd

index 14827ee635a5b474272fdf4b2932642a94d60396..7c75c9854383bcdc55aff499a5119e3b4570323d 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -96,15 +96,28 @@ die() {
 
 # find program from specified paths
 find_tool() {
-       local x
+       local x p b n
+       local paths="$initrd_dir /bin /sbin /usr/bin /usr/sbin"
        for x in "$@"; do
+               verbose "find_tool: checking $x"
                if [ -x "$x" ]; then
                        echo $x
                        verbose "find_tool: found $x"
                        return 0
                fi
+               n="$x"
+               for p in $paths; do
+                       b=$(basename $x)
+                       verbose "find_tool: checking $p/$b"
+                       if [ -x "$p/$b" ]; then
+                               echo $p/$b
+                               verbose "find_tool: found $p/$b"
+                               return 0
+                       fi
+                       n="$n $p/$b"
+               done
        done
-       debug "find_tool: did not find any of: $@"
+       debug "find_tool: did not find any of: $n"
        return 1
 }
 
This page took 0.040045 seconds and 4 git commands to generate.