[readonly/geninitrd/BUSYBOX: 20/113] - added a lot of ""s :)

draenog draenog at pld-linux.org
Sat Nov 2 19:11:42 CET 2013


commit 351643813acb524c99168288bd5404991fb0bd17
Author: Sebastian Zagrodzki <sebek at zagrodzki.net>
Date:   Sat Jan 6 15:22:28 2001 +0000

    - added a lot of ""s :)
    
    
    svn-id: @1172

 geninitrd | 164 +++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 82 insertions(+), 82 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 16d8869..f46f6cf 100755
--- a/geninitrd
+++ b/geninitrd
@@ -39,7 +39,7 @@ verbose=""
 MODULES=""
 img_vers=""
 modulefile=/etc/modules.conf
-if [ `uname -m` = "ia64" ]; then
+if [ "`uname -m`" = "ia64" ]; then
   IMAGESIZE=3000
 else
   IMAGESIZE=1500
@@ -61,9 +61,9 @@ usage () {
 findmodule() {
     skiperrors=""
     modName=$1
-    if [ $(echo $modName | cut -b1) = "-" ]; then
+    if [ "$(echo $modName | cut -b1)" = "-" ]; then
 	skiperrors=1
-	modName=$(echo $modName | cut -b2-)
+	modName="$(echo $modName | cut -b2-)"
     fi
 
     if [ "$modName" = "pluto" ]; then
@@ -75,9 +75,9 @@ findmodule() {
 	findmodule socal
     fi
 
-    fmPath=`(cd /lib/modules/$kernel; find -type f -name $modName.o)`
+    fmPath="`(cd /lib/modules/$kernel; find -type f -name "$modName.o")`"
 
-    if [ ! -f /lib/modules/$kernel/$fmPath ]; then
+    if [ ! -f "/lib/modules/$kernel/$fmPath" ]; then
 	if [ -n "$skiperrors" ]; then
 	    return
 	fi
@@ -101,8 +101,8 @@ findmodule() {
     fi
 
     # only need to add each module once
-    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
+    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
 }
@@ -113,7 +113,7 @@ inst() {
         return
     fi 
     [ -n "$verbose" ] && echo "$1 -> $2"
-    cp $1 $2
+    cp "$1" "$2"
 }
 
 
@@ -125,18 +125,18 @@ while [ $# -gt 0 ]; do
 	    
 	--fstab*)
 	    if is_yes "`echo $1 | awk '/=/ { print "yes"; }'`" ; then
-	    	fstab=`echo $1 | awk -F= '{print $2;}'`
+	    	fstab="`echo $1 | awk -F= '{print $2;}'`"
 	    else
-		fstab=$2
+		fstab="$2"
 		shift
 	    fi		    
 	    ;;
 
 	--with*)
 	    if is_yes "`echo $1 | awk '/=/ { print "yes"; }'`" ; then
-	    	modname=`echo $1 | awk -F= '{print $2;}'`
+	    	modname="`echo $1 | awk -F= '{print $2;}'`"
 	    else
-		modname=$2
+		modname="$2"
 		shift
 	    fi		    
 
@@ -165,9 +165,9 @@ while [ $# -gt 0 ]; do
 	    ;;
 	--preload)
 	    if is_yes "`echo $1 | awk '/=/ { print "yes"; }'`" ; then
-	    	modname=`echo $1 | awk -F= '{print $2;}'`
+	    	modname="`echo $1 | awk -F= '{print $2;}'`"
 	    else
-		modname=$2
+		modname="$2"
 		shift
 	    fi		    
 	    PREMODS="$PREMODS $modname"
@@ -183,20 +183,20 @@ while [ $# -gt 0 ]; do
 	    PROBEIDE="no";
 	    ;;
 	--fs)
-	    FS=$2
+	    FS="$2"
 	    shift
 	    ;;
 	--fs*)
-	    FS=`echo $1 | awk -F= '{print $2;}'`
+	    FS="`echo $1 | awk -F= '{print $2;}'`"
 	    ;;
 	--image-version)
 	    img_vers=yes
 	    ;;
 	*)
 	    if [ -z "$target" ]; then
-		target=$1
+		target="$1"
 	    elif [ -z "$kernel" ]; then
-		kernel=$1
+		kernel="$1"
 	    else
 		usage
 	    fi
@@ -239,38 +239,38 @@ if [ -n "$img_vers" ]; then
     target="$target-$kernel"
 fi
 
-if [ -z "$force" -a -f $target ]; then
+if [ -z "$force" -a -f "$target" ]; then
     echo "$target already exists." >&2
     exit 1
 fi
 
-if [ ! -d /lib/modules/$kernel ]; then
+if [ ! -d "/lib/modules/$kernel" ]; then
     echo "/lib/modules/$kernel is not a directory." >&2
     exit 1
 fi
 
 for n in $PREMODS; do
-	findmodule $n
+	findmodule "$n"
 done
 
-rootdev=$(awk '{ if ($2 == "/") { print $1; }}' $fstab)
-if is_yes "$PROBESCSI" && is_yes "`echo "$rootdev" | awk '/^\/dev\/sd/ { print "yes"; }'`" ; then
+rootdev="$(awk '{ if ($2 == "/") { print $1; }}' $fstab)"
+if is_yes "$PROBESCSI" && is_yes "$(echo "$rootdev" | awk '/^\/dev\/sd/ { print "yes"; }')" ; then
 
     for n in $PRESCSIMODS; do
 	if [ "$n" = "unknown" ] ; then
-    		if [ ! -f $modulefile ]; then
+    		if [ ! -f "$modulefile" ]; then
         		modulefile=/etc/conf.modules
     		fi
-    		if [ -f $modulefile ]; then
-			scsimodules=`awk '/scsi_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile| LC_ALL=C sort -u`
+    		if [ -f "$modulefile" ]; then
+			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/
-	    		findmodule $n
+	    			findmodule "$n"
 			done
     		fi
 	else
-	    findmodule $n
+	    findmodule "$n"
 	fi
     done
 
@@ -278,17 +278,17 @@ fi
 
 if is_yes "$PROBEIDE" && is_yes "`echo "$rootdev" | awk '/^\/dev\/hd/ { print "yes"; }'`" ; then
     for n in $PREIDEMODS; do
-	    findmodule $n
+	    findmodule "$n"
     done
 fi
 
 if is_yes "$PROBERAID" ; then
     # load appropriate raid devices if necessary
-    if is_yes "`awk '/^\/dev\/md/ && ! /noauto/ { print "yes"; }' $fstab`" ; then
+    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
+	    case "$number" in
 	    [0145])
-		findmodule raid$number
+		findmodule "raid$number"
 		;;
 	    *)
 		echo "raid level $number (in /etc/raidtab) not recognized" >&2
@@ -299,7 +299,7 @@ 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" | cut -d/ -f3 | awk '/loop/ { print "yes"; }'`" ; then
     if [ ! -x /sbin/losetup ]; then
 	echo "losetup is missing"
 	exit 1
@@ -311,10 +311,10 @@ if is_yes "`echo $rootdev | cut -d/ -f3 | awk '/loop/ { print "yes"; }'`" ; then
 	exit 1
     fi
 
-    line=`awk '/'$key'/ { print $0; }' $fstab`
-    loopDev=$(echo $line | awk '{print $3}')
-    loopFs=$(echo $line | awk '{print $4}')
-    loopFile=$(echo $line | awk '{print $5}')
+    line="`awk '/'$key'/ { print $0; }' $fstab`"
+    loopDev="$(echo $line | awk '{print $3}')"
+    loopFs="$(echo $line | awk '{print $4}')"
+    loopFile="$(echo $line | awk '{print $5}')"
 
     BASICMODULES="$BASICMODULES -loop"
     findmodule "-$loopFs"
@@ -323,12 +323,12 @@ if is_yes "`echo $rootdev | cut -d/ -f3 | awk '/loop/ { print "yes"; }'`" ; then
     # anyway no bsp
     USEBSP="no"
 else # Check for other filesystems
-    rootFs=`awk '{if ($2 == "/") {print $3}}' $fstab`
+    rootFs="`awk '{if ($2 == "/") {print $3}}' $fstab`"
     findmodule "-$rootFs"
 fi
 
 for n in $BASICMODULES; do 
-    findmodule $n
+    findmodule "$n"
 done
 
 if [ -n "$ifneeded" -a -z "$MODULES" ]; then
@@ -342,88 +342,88 @@ if [ -n "$verbose" ]; then
     echo "Using modules: $MODULES"
 fi
 
-MNTIMAGE=`mktemp -d /tmp/initrd.XXXXXX`
-IMAGE=`mktemp -u /tmp/initrd.img-XXXXXX`
-MNTPOINT=`mktemp -d /tmp/initrd.mnt-XXXXXX`
-RCFILE=$MNTIMAGE/linuxrc
+MNTIMAGE="`mktemp -d /tmp/initrd.XXXXXX`"
+IMAGE="`mktemp -u /tmp/initrd.img-XXXXXX`"
+MNTPOINT="`mktemp -d /tmp/initrd.mnt-XXXXXX`"
+RCFILE="$MNTIMAGE/linuxrc"
 
-if [ -f $MNTIMAGE ]; then
+if [ -f "$MNTIMAGE" ]; then
     echo "$MNTIMAGE already exists.  Remove it and try again" >&2
     exit 1
 fi
 
-if [ -f $IMAGE ]; then
+if [ -f "$IMAGE" ]; then
     echo "$IMAGE already exists. Remove it and try again" >&2
     exit 1
 fi
 
 if [ "$FS" = "ext2" ] ; then
-	dd if=/dev/zero of=$IMAGE bs=1k count=$IMAGESIZE 2> /dev/null
+	dd if=/dev/zero of="$IMAGE" bs=1k count="$IMAGESIZE" 2> /dev/null
 
 	# We have to "echo y |" so that it doesn't complain about $IMAGE not
 	# being a block device
-	echo y | mke2fs -F $IMAGE $IMAGESIZE >/dev/null 2>/dev/null
+	echo y | mke2fs -F "$IMAGE" "$IMAGESIZE" >/dev/null 2>/dev/null
 
-	mkdir -p $MNTPOINT
-	mount -o loop -t ext2 $IMAGE $MNTPOINT 
+	mkdir -p "$MNTPOINT"
+	mount -o loop -t ext2 "$IMAGE" "$MNTPOINT"
 else
-	mkdir -p $MNTPOINT
+	mkdir -p "$MNTPOINT"
 fi
 
 
-mkdir -p $MNTIMAGE/{lib,bin,etc,dev,loopfs}
+mkdir -p "$MNTIMAGE"/{lib,bin,etc,dev,loopfs}
 
 
 # We don't need this directory, so let's save space
-rm -rf $MNTPOINT/lost+found
+rm -rf "$MNTPOINT"/lost+found
 
 for MODULE in $MODULES; do
-    cp $verbose -a /lib/modules/$kernel/$MODULE $MNTIMAGE/lib
+    cp $verbose -a "/lib/modules/$kernel/$MODULE" "$MNTIMAGE/lib"
 done
 
 # mknod'ing the devices instead of copying them works both with and
 # without devfs...
-mknod $MNTIMAGE/dev/console c 5 1
+mknod "$MNTIMAGE/dev/console" c 5 1
 
 if is_yes "$USEBSP" ; then
-    s=$MNTIMAGE/etc/startup
+    s="$MNTIMAGE/etc/startup"
     inst /sbin/bsp "$RCFILE"
-    echo "# autogenerated startup" > $s
-    echo "" >> $s
+    echo "# autogenerated startup" > "$s"
+    echo "" >> "$s"
     
     for MODULE in $MODULES; do
-        module=`echo $MODULE | awk -F/ '{ $0=$NF } /.o$/ { $0=substr($0,1,length($0)-2); } { print $0; }'`
-        options=`awk '{ if($1 == "options" && $2 == "'${module}'") { for(i=3;i<=NF;i++) printf("%s ",$i); }}' $modulefile`
+        module="`echo $MODULE | awk -F/ '{ $0=$NF } /.o$/ { $0=substr($0,1,length($0)-2); } { print $0; }'`"
+        options="`awk '{ if($1 == "options" && $2 == "'${module}'") { for(i=3;i<=NF;i++) printf("%s ",$i); }}' "$modulefile"`"
     
         if [ -n "$verbose" ]; then
             echo "Loading module $module with options $options"
         fi
-        echo "insmod $module.o $options" >> $s
+        echo "insmod $module.o $options" >> "$s"
     done
 else
     inst /bin/trash "$MNTIMAGE/bin/sh"
     inst /sbin/insmod.static "$MNTIMAGE/bin/insmod"
     
-    mknod $MNTIMAGE/dev/null c 1 3
-    mknod $MNTIMAGE/dev/ram b 1 1
-    mknod $MNTIMAGE/dev/systty c 4 0
+    mknod "$MNTIMAGE/dev/null" c 1 3
+    mknod "$MNTIMAGE/dev/ram" b 1 1
+    mknod "$MNTIMAGE/dev/systty" c 4 0
     for i in 1 2 3 4; do
-        mknod $MNTIMAGE/dev/tty$i c 4 1
+        mknod "$MNTIMAGE/dev/tty$i" c 4 1
     done
-    mknod $MNTIMAGE/dev/zero c 1 5
+    mknod "$MNTIMAGE/dev/zero" c 1 5
     
-    echo "#!/bin/sh" > $RCFILE
-    echo "" >> $RCFILE
+    echo "#!/bin/sh" > "$RCFILE"
+    echo "" >> "$RCFILE"
     
     for MODULE in $MODULES; do
-        module=`echo $MODULE | awk -F/ '{ $0=$NF } /.o$/ { $0=substr($0,1,length($0)-2); } { print $0; }'`
-        options=`awk '{ if($1 == "options" && $2 == "'${module}'") { for(i=3;i<=NF;i++) printf("%s ",$i); }}' $modulefile`
+        module="`echo $MODULE | awk -F/ '{ $0=$NF } /.o$/ { $0=substr($0,1,length($0)-2); } { print $0; }'`"
+        options="`awk '{ if($1 == "options" && $2 == "'${module}'") { for(i=3;i<=NF;i++) printf("%s ",$i); }}' "$modulefile"`"
     
         if [ -n "$verbose" ]; then
             echo "Loading module $module with options $options"
         fi
-        echo "echo \"Loading $module module\"" >> $RCFILE
-        echo "insmod /lib/$module.o $options" >> $RCFILE
+        echo "echo \"Loading $module module\"" >> "$RCFILE"
+        echo "insmod /lib/$module.o $options" >> "$RCFILE"
     done
     
     if [ -n "$loopDev" ]; then
@@ -431,22 +431,22 @@ else
     	mkdir /initrd
         fi
     
-        cp -a $loopDev $MNTIMAGE/dev
-        cp -a $rootdev $MNTIMAGE/dev
-        echo "echo Mounting device containing loopback root filesystem" >> $RCFILE
-        echo "mount -t $loopFs $loopDev /loopfs" >> $RCFILE
+        cp -a "$loopDev" "$MNTIMAGE/dev"
+        cp -a "$rootdev" "$MNTIMAGE/dev"
+        echo "echo Mounting device containing loopback root filesystem" >> "$RCFILE"
+        echo "mount -t $loopFs $loopDev /loopfs" >> "$RCFILE"
         echo "echo Setting up loopback device $rootdev" >> $RCFILE
-        echo "losetup $rootdev /loopfs$loopFile" >> $RCFILE
+        echo "losetup $rootdev /loopfs$loopFile" >> "$RCFILE"
     fi
 fi
 
-chmod +x $RCFILE
+chmod +x "$RCFILE"
 
-(cd $MNTIMAGE; tar cf - .) | (cd $MNTPOINT; tar xf -)
+(cd "$MNTIMAGE"; tar cf - .) | (cd "$MNTPOINT"; tar xf -)
 
 case "$FS" in
 	ext2)
-		umount $IMAGE
+		umount "$IMAGE"
 		;;
 	rom)
 		genromfs -f "$IMAGE" -d "$MNTPOINT" -V "PLD initrd for kernel $kernel"
@@ -459,8 +459,8 @@ case "$FS" in
 esac		
 
 if is_yes "$COMPRESS" ; then
-    gzip -9 < $IMAGE > $target
+    gzip -9 < "$IMAGE" > "$target"
 else
-    cp -a $IMAGE $target
+    cp -a "$IMAGE" "$target"
 fi
-rm -rf $MNTIMAGE $MNTPOINT $IMAGE
+rm -rf "$MNTIMAGE" "$MNTPOINT" "$IMAGE"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/0999a53e93eedcf489380684b998ce04aaddf11c



More information about the pld-cvs-commit mailing list