SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Thu Oct 25 09:26:22 CEST 2007


Author: glen
Date: Thu Oct 25 09:26:22 2007
New Revision: 8866

Modified:
   geninitrd/trunk/geninitrd
Log:
- optimize, cosmetics

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Thu Oct 25 09:26:22 2007
@@ -180,7 +180,7 @@
 ' $depfile | xargs)
 
 	# fallback to $modext
-	if [ "$mods" = "" ] ; then
+	if [ "$mods" = "" ]; then
 		module=$(echo "$module" | awk '{gsub("\'$modext'\.gz$","\'$modext'",$0);print}')
 		# ") - vim
 	fi
@@ -192,8 +192,8 @@
 /(.*)/ { gsub(/\\/," "); if (here) print }
 ' $depfile | xargs)
 
-	if [ "$mods" = "" ] ; then
-		if [ "$1" != silent ] ; then
+	if [ "$mods" = "" ]; then
+		if [ "$1" != silent ]; then
 			echo >&2 "$origmodule: module not found in $depfile"
 		fi
 		if ! is_no "$EXIT_IF_MISSING"; then
@@ -204,17 +204,17 @@
 	fi
 
 	level=$3
-	if [ "$level" = "" ] ; then
+	if [ "$level" = "" ]; then
 		level=0
 	fi
 	level=$((level + 1))
-	if [ $level -gt 20 ] ; then
+	if [ $level -gt 20 ]; then
 		die "$origmodule: cycle in $depfile"
 	fi
 
 	first=
 	for f in $mods ; do
-		if [ "$first" = "" ] ; then
+		if [ "$first" = "" ]; then
 			first=$f
 		else
 			find_depmod $1 $f $level
@@ -372,7 +372,7 @@
 
 find_modules_scsi() {
 	for n in $PRESCSIMODS; do
-		if [ "X$n" = "Xunknown" ] ; then
+		if [ "X$n" = "Xunknown" ]; then
 			if [ -f "$modulefile" ]; then
 				scsimodules="`awk '/scsi_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
 				for n in $scsimodules; do
@@ -402,7 +402,7 @@
 	else
 		tryauto=1
 		for n in $PREIDEMODS; do
-			if [ "X$n" = "Xunknown" ] ; then
+			if [ "X$n" = "Xunknown" ]; then
 				if [ -f "$modulefile" ]; then
 					debug "Finding IDE modules using ide_hostadapter"
 					idemodules="`awk '/ide_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
@@ -602,7 +602,7 @@
 	debug "find_modules_for_device($devpath)"
 
 	if is_yes "`echo "$devpath" | awk '/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:|\/dev\/nfs)/ { print "yes"; }'`"; then
-		if [ ! -x /usr/bin/pcidev -a -z "$NFS_ETH_MODULES" ] ; then
+		if [ ! -x /usr/bin/pcidev -a -z "$NFS_ETH_MODULES" ]; then
 			die "root on NFS but /usr/bin/pcidev not found. Please install correct pci-database package and rerun $PROGRAM."
 		fi
 		local m
@@ -647,22 +647,22 @@
 		return
 	fi
 
-	if is_yes "`echo "$devpath" | awk '/\/dev\/rd\// { print "yes"; }'`" ; then
+	if [[ "$devpath" == /dev/rd/* ]]; then
 		findmodule "DAC960"
 		return
 	fi
 
-	if is_yes "`echo "$devpath" | awk '/\/dev\/ida\// { print "yes"; }'`" ; then
+	if [[ "$devpath" == /dev/ida/* ]]; then
 		findmodule "cpqarray"
 		return
 	fi
 
-	if is_yes "`echo "$devpath" | awk '/\/dev\/cciss\// { print "yes"; }'`" ; then
+	if [[ "$devpath" == /dev/ccis/* ]]; then
 		findmodule "cciss"
 		return
 	fi
 
-	if is_yes "`echo "$devpath" | awk '/\/dev\/ataraid\// { print "yes"; }'`"; then
+	if [[ "$devpath" == /dev/ataraid/* ]]; then
 		find_modules_ide
 		findmodule "ataraid"
 		ataraidmodules="`awk '/ataraid_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
@@ -677,7 +677,7 @@
 	fi
 
 	# check to see if we need to set up a loopback filesystem
-	if is_yes "`echo "$devpath" | awk -F/ '{print($3);}' | awk '/loop/ { print "yes"; }'`" ; then
+	if [[ "$devpath" == /dev/loop*  ]]; then
 		die "Sorry, root on loop device isn't supported."
 		# TODO: rewrite for bsp and make nfs ready
 		if [ ! -x /sbin/losetup ]; then
@@ -702,20 +702,20 @@
 	if _check_lvm "$devpath"; then
 		node="$devpath"
 
-		if [ ! -f /sbin/initrd-lvm -o ! -x /sbin/lvdisplay -o ! -x /sbin/pvdisplay ] ; then
+		if [ ! -f /sbin/initrd-lvm -o ! -x /sbin/lvdisplay -o ! -x /sbin/pvdisplay ]; then
 			die "root on LVM but /sbin/initrd-lvm, /sbin/lvdisplay and /sbin/pvdisplay not found. Please install lvm(2) and lvm(2)-initrd package and rerun $PROGRAM."
 		fi
-		if [ -z "$LVMTOOLSVERSION" ] ; then
+		if [ -z "$LVMTOOLSVERSION" ]; then
 			LVMTOOLSVERSION=$(/sbin/initrd-lvm vgchange --version 2>/dev/null|head -n 1|awk '{gsub("vgchange: Logical Volume Manager ",NIL); gsub("LVM version:     ",NIL); gsub(/\..*/,NIL); print $1}')
-			if [ -z "$LVMTOOLSVERSION" ] ; then
+			if [ -z "$LVMTOOLSVERSION" ]; then
 				die "Can't determine LVM tools version. Please set LVMTOOLSVERSION and rerun $PROGRAM."
 			fi
 		fi
-		if [ -z "$PVDEVICES" ] ; then
+		if [ -z "$PVDEVICES" ]; then
 			VGVOLUME=$(/sbin/lvdisplay -c "$node" 2> /dev/null | awk -F":" ' { print $2 } ')
 			PVDEVICES=$(/sbin/pvdisplay -c 2>/dev/null | awk -F":" -v vg="$VGVOLUME" ' BEGIN { devices="" } { if ($2 == vg) { devices = devices " " $1 } } END { print devices } ')
 		fi
-		if [ -n "$PVDEVICES" ] ; then
+		if [ -n "$PVDEVICES" ]; then
 			for device in $PVDEVICES; do
 				find_modules_for_device $device
 			done
@@ -802,7 +802,7 @@
 
 		if [ -n "$verbose" ]; then
 			echo -n "Loading module [$module] "
-			if [ -n "$options" ] ; then
+			if [ -n "$options" ]; then
 				echo -n "with options [$options]"
 			else
 				echo -n "without options"
@@ -827,24 +827,24 @@
 	done
 }
 
-if [ -r /etc/sysconfig/geninitrd ] ; then
+if [ -r /etc/sysconfig/geninitrd ]; then
 	. /etc/sysconfig/geninitrd
 fi
 
-if [ -r /etc/sysconfig/bootsplash ] ; then
+if [ -r /etc/sysconfig/bootsplash ]; then
 	. /etc/sysconfig/bootsplash
 fi
 
-if [ -r /etc/sysconfig/fbsplash ] ; then
+if [ -r /etc/sysconfig/fbsplash ]; then
 	. /etc/sysconfig/fbsplash
 fi
 
-if [ ! -x /bin/initrd-busybox ] ; then
+if [ ! -x /bin/initrd-busybox ]; then
 	die "/bin/initrd-busybox is missing!"
 fi
 
 # backwards compatible
-if [ "$USE_SUSPEND2" ] ; then
+if [ "$USE_SUSPEND2" ]; then
 	USE_TUXONICE=$USE_SUSPEND2
 	echo >&2 "USE_SUSPEND2 is deprecated, use USE_TUXONICE now instead."
 fi
@@ -993,10 +993,10 @@
 pack_version="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d",$1,$2)}'`"
 pack_version_long="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d%03d",$1,$2,$3)}'`"
 
-if [ "x" = "x$INITRDFS" ] ; then
-	if [ "x" = "x$FS" ] ; then
+if [ "x" = "x$INITRDFS" ]; then
+	if [ "x" = "x$FS" ]; then
 		# default value
-		if [ "$pack_version" -ge "002005" ] ; then
+		if [ "$pack_version" -ge "002005" ]; then
 			INITRDFS="initramfs"
 		else
 			INITRDFS="rom"
@@ -1007,12 +1007,12 @@
 	fi
 fi
 
-if [ "$pack_version" -lt "002006" ] ; then
+if [ "$pack_version" -lt "002006" ]; then
 	USE_UDEV=
 	USE_DMRAID=
 fi
 
-if [ "$pack_version" -ge "002005" ] ; then
+if [ "$pack_version" -ge "002005" ]; then
 	modext=".ko"
 	insmod="insmod"
 fi
@@ -1020,10 +1020,10 @@
 if is_yes "$USEINSMODSTATIC" ; then
 	insmod="insmod.static"
 	INSMOD="/sbin/insmod.static"
-	if [ "$pack_version" -lt "002005" -a -f /sbin/insmod.static.modutils ] ; then
+	if [ "$pack_version" -lt "002005" -a -f /sbin/insmod.static.modutils ]; then
 		INSMOD="/sbin/insmod.static.modutils"
 	fi
-	if [ ! -f "$INSMOD" ] ; then
+	if [ ! -f "$INSMOD" ]; then
 		die "insmod.static requested but /sbin/insmod.static not found!"
 	fi
 fi
@@ -1343,7 +1343,7 @@
 }
 
 initrd_gen_dmraid() {
-	if [ ! -x /sbin/dmraid-initrd ] ; then
+	if [ ! -x /sbin/dmraid-initrd ]; then
 		die "/sbin/dmraid-initrd is missing!"
 	fi
 
@@ -1433,7 +1433,7 @@
 	echo "mdassemble" >> "$s"
 
 	# needed to determine md-version
-	if [ "$do_md0" -eq 1 ] ; then
+	if [ "$do_md0" -eq 1 ]; then
 		mknod $MNTIMAGE/dev/md0 b 9 0
 	fi
 }
@@ -1507,7 +1507,7 @@
 	fi
 	echo "mount -t proc none /proc" >> "$s"
 	echo "mount -t tmpfs none /tmp" >> "$s"
-	if [ "$LVMTOOLSVERSION" = "1" ] ; then
+	if [ "$LVMTOOLSVERSION" = "1" ]; then
 		echo "lvm vgscan -T" >> "$s"
 		echo "lvm vgchange -T -a y $VGVOLUME" >> "$s"
 		echo "umount /tmp" >> "$s"
@@ -1682,7 +1682,7 @@
 
 	busybox_applet switch_root
 	cat << EOF >> "$s"
-if [ "\$device" = '/dev/no_partition_found' ] ; then
+if [ "\$device" = '/dev/no_partition_found' ]; then
 	device="$rootdev"
 fi
 


More information about the pld-cvs-commit mailing list