]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
change all 'grep' into 'awk'
authoringlod <inglod@pld-linux.org>
Thu, 16 Nov 2000 14:17:40 +0000 (14:17 +0000)
committeringlod <inglod@pld-linux.org>
Thu, 16 Nov 2000 14:17:40 +0000 (14:17 +0000)
svn-id: @1163

geninitrd

index a58caf4487793847bba225358f955fed86915e77..ce224c6ee2f609b85585cb28532153ddfeb80abd 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -99,7 +99,8 @@ findmodule() {
     fi
 
     # only need to add each module once
-    if echo $MODULES | grep $fmPath >/dev/null 2>&1 ; then : ; else
+    tmpFmPath=`echo $fmPath|awk -F/ '{for(i=1;i<NF;i++) { printf("%s\\/",$i); } { print $NF; }}'`
+    if is_yes "`echo $MODULES | awk '/"'$tmpFmPath'"/ { print "yes"; }' `" ; then : ; else
        MODULES="$MODULES $fmPath"
     fi
 }
@@ -117,7 +118,7 @@ inst() {
 while [ $# -gt 0 ]; do
     case $1 in
        --fstab*)
-           if echo $1 | grep '=' >/dev/null ; then
+           if is_yes "`echo $1 | awk '/=/ { print "yes"; }'`" ; then
                fstab=`echo $1 | awk -F= '{print $2;}'`
            else
                fstab=$2
@@ -126,7 +127,7 @@ while [ $# -gt 0 ]; do
            ;;
 
        --with*)
-           if echo $1 | grep '=' >/dev/null ; then
+           if is_yes "`echo $1 | awk '/=/ { print "yes"; }'`" ; then
                modname=`echo $1 | awk -F= '{print $2;}'`
            else
                modname=$2
@@ -157,7 +158,7 @@ while [ $# -gt 0 ]; do
            force=1
            ;;
        --preload)
-           if echo $1 | grep '=' >/dev/null ; then
+           if is_yes "`echo $1 | awk '/=/ { print "yes"; }'`" ; then
                modname=`echo $1 | awk -F= '{print $2;}'`
            else
                modname=$2
@@ -247,7 +248,7 @@ for n in $PREMODS; do
 done
 
 rootdev=$(awk '{ if ($2 == "/") { print $1; }}' $fstab)
-if is_yes "$PROBESCSI" && echo "$rootdev" | grep -q "^/dev/sd" ; then
+if is_yes "$PROBESCSI" && is_yes "`echo "$rootdev" | awk '/^\/dev\/sd/ { print "yes"; }'`" ; then
 
     for n in $PRESCSIMODS; do
        if [ "$n" = "unknown" ] ; then
@@ -255,7 +256,7 @@ if is_yes "$PROBESCSI" && echo "$rootdev" | grep -q "^/dev/sd" ; then
                        modulefile=/etc/conf.modules
                fi
                if [ -f $modulefile ]; then
-                       scsimodules=`grep scsi_hostadapter $modulefile | grep -v '^[    ]*#' | LC_ALL=C sort -u | awk '{ print $3 }'`
+                       scsimodules=`awk '/scsi_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile| LC_ALL=C sort -u`
                        for n in $scsimodules; do
                # for now allow scsi modules to come from anywhere.  There are some
                # RAID controllers with drivers in block/
@@ -269,7 +270,7 @@ if is_yes "$PROBESCSI" && echo "$rootdev" | grep -q "^/dev/sd" ; then
 
 fi
 
-if is_yes "$PROBEIDE" && echo "$rootdev" | grep -q "^/dev/hd" ; then
+if is_yes "$PROBEIDE" && is_yes "`echo "$rootdev" | awk '/^\/dev\/hd/ { print "yes"; }'`" ; then
     for n in $PREIDEMODS; do
            findmodule $n
     done
@@ -277,9 +278,8 @@ fi
 
 if is_yes "$PROBERAID" ; then
     # load appropriate raid devices if necessary
-    if grep '^/dev/md' $fstab | grep -v noauto >/dev/null 2>&1 ; then
-       for number in $(grep '^[        ]*raid-level' /etc/raidtab |
-                         awk '{print $2}' | LC_ALL=C sort -u) ; do
+    if is_yes "`awk '/^\/dev\/md/ && ! /noauto/ { print "yes"; }' $fstab`" ; then
+       for number in $(awk '/^[\t ]*raid-level/ { print $2; }' /etc/raidtab | LC_ALL=C sort -u) ; do
            case $number in
            [0145])
                findmodule raid$number
@@ -293,15 +293,15 @@ if is_yes "$PROBERAID" ; then
 fi
 
 # check to see if we need to set up a loopback filesystem
-if echo $rootdev | cut -d/ -f3 | grep loop >/dev/null; then
+if is_yes "`echo $rootdev | cut -d/ -f3 | awk '/loop/ { print "yes"; }'`" ; then
     key="^# $(echo $rootdev | cut -d/ -f3 | tr '[a-z]' '[A-Z]'):"
-    if ! grep "$key" $fstab > /dev/null; then
+    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
        exit 1
     fi
 
-    line=$(grep "$key" $fstab)
+    line=`awk '/'$key'/ { print $0; }' $fstab`
     loopDev=$(echo $line | awk '{print $3}')
     loopFs=$(echo $line | awk '{print $4}')
     loopFile=$(echo $line | awk '{print $5}')
This page took 0.308042 seconds and 4 git commands to generate.