]> git.pld-linux.org Git - projects/geninitrd.git/blobdiff - geninitrd
find remove
[projects/geninitrd.git] / geninitrd
index f46f6cfe13e00aa1fce8f1c3e2d9c3b95ff03a44..14c427f800b0034132aed9d2ec2fb7a1fa55ed72 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -32,6 +32,9 @@ if [ -f /etc/sysconfig/initrd ] ; then
        . /etc/sysconfig/initrd
 fi
 
+if is_yes $USEBSP ; then
+       [ ! -x /sbin/bsp ] && USEBSP="no"
+fi
 target=""
 kernel=""
 force=""
@@ -58,12 +61,24 @@ usage () {
     exit 1
 }
 
+
+my_find() {
+       for name in `ls`
+       do
+          if [ -d $name ]; then
+               (cd $name;my_find $1/$name $2)
+          else
+               [ -f $name -a "$name" = "$2" ] && echo $1/$name
+          fi
+       done
+}
+
 findmodule() {
     skiperrors=""
     modName=$1
-    if [ "$(echo $modName | cut -b1)" = "-" ]; then
+    if [ "$(echo $modName | awk '{print(substr($0,1,1));}')" = "-" ]; then
        skiperrors=1
-       modName="$(echo $modName | cut -b2-)"
+       modName="$(echo $modName | awk '{print(substr($0,2));}')"
     fi
 
     if [ "$modName" = "pluto" ]; then
@@ -75,7 +90,7 @@ findmodule() {
        findmodule socal
     fi
 
-    fmPath="`(cd /lib/modules/$kernel; find -type f -name "$modName.o")`"
+    fmPath="`(cd /lib/modules/$kernel; my_find . "$modName.o")`"
 
     if [ ! -f "/lib/modules/$kernel/$fmPath" ]; then
        if [ -n "$skiperrors" ]; then
@@ -299,12 +314,12 @@ if is_yes "$PROBERAID" ; then
 fi
 
 # check to see if we need to set up a loopback filesystem
-if is_yes "`echo "$rootdev" | cut -d/ -f3 | awk '/loop/ { print "yes"; }'`" ; then
+if is_yes "`echo "$rootdev" | awk -F/ '{print($3);}' | awk '/loop/ { print "yes"; }'`" ; then
     if [ ! -x /sbin/losetup ]; then
        echo "losetup is missing"
        exit 1
     fi
-    key="^# $(echo $rootdev | cut -d/ -f3 | tr '[a-z]' '[A-Z]'):"
+    key="^# $(echo $rootdev | awk -F/ '{print($3);}' | tr '[a-z]' '[A-Z]'):"
     if ! is_yes "`awk '/'$key'/ { print( "yes"); }' $fstab`" ; then
        echo "The root filesystem is on a $rootdev, but there is no magic entry in $fstab" 1>&2
        echo "for this device. Consult the geninitrd man page for more information" 2>&2
This page took 0.093814 seconds and 4 git commands to generate.