SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Wed Oct 24 17:53:34 CEST 2007


Author: glen
Date: Wed Oct 24 17:53:33 2007
New Revision: 8851

Modified:
   geninitrd/trunk/geninitrd
Log:
- find_modules_for(): allow fallback if primary condition succeeded

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Wed Oct 24 17:53:33 2007
@@ -538,13 +538,29 @@
 		usenfs="yes"
 		echo "Remember to use \`root=/dev/ram0 init=/linuxrc' when starting kernel" >&2
 		echo "or you will have problems like init(xx) being child process of swapper(1)." >&2
-	elif is_yes "`echo "$devpath" | awk '/^\/dev\/md/ { print "yes"; }'`"; then
+		return
+	fi
+
+	if is_yes "`echo "$devpath" | awk '/^\/dev\/md/ { print "yes"; }'`"; then
 		find_modules_softraid "$devpath"
-	elif is_yes "$(echo "$devpath" | awk '/^\/dev\/(sd|scsi)/ { print "yes"; }')" ; then
+		return
+	fi
+
+	if is_yes "$(echo "$devpath" | awk '/^\/dev\/(sd|scsi)/ { print "yes"; }')" ; then
 		find_modules_scsi
-	elif is_yes "`echo "$devpath" | awk '/^\/dev\/(hd|ide)/ { print "yes"; }'`" ; then
+		return
+	fi
+
+	if is_yes "`echo "$devpath" | awk '/^\/dev\/(hd|ide)/ { print "yes"; }'`" ; then
 		find_modules_ide "$devpath"
-	elif is_yes "`echo "$devpath" | awk '/^\/dev\/mapper\/(sil|hpt37x|hpt45x|isw|lsi|nvidia|pdc|sil|via|dos)_/ { print "yes"; }'`"; then
+		return
+	fi
+
+	if [[ "$devpath" == /dev/mapper/* ]] && is_yes "$USE_MULTIPATH"; then
+		:
+	fi
+
+	if is_yes "$(echo "$devpath" | awk '/^\/dev\/mapper\/(sil|hpt37x|hpt45x|isw|lsi|nvidia|pdc|sil|via|dos)_/ { print "yes"; }')"; then
 		# dmraid nodes taken from: `dmraid -l` output
 		if [ ! -x /usr/sbin/dmraid ]; then
 			die "root on dmraid but /usr/sbin/dmraid not found."
@@ -563,14 +579,25 @@
 
 		# XXX probably should detect
 		findmodule "dm-mirror"
+		return
+	fi
 
-	elif is_yes "`echo "$devpath" | awk '/\/dev\/rd\// { print "yes"; }'`" ; then
+	if is_yes "`echo "$devpath" | awk '/\/dev\/rd\// { print "yes"; }'`" ; then
 		findmodule "DAC960"
-	elif is_yes "`echo "$devpath" | awk '/\/dev\/ida\// { print "yes"; }'`" ; then
+		return
+	fi
+
+	if is_yes "`echo "$devpath" | awk '/\/dev\/ida\// { print "yes"; }'`" ; then
 		findmodule "cpqarray"
-	elif is_yes "`echo "$devpath" | awk '/\/dev\/cciss\// { print "yes"; }'`" ; then
+		return
+	fi
+
+	if is_yes "`echo "$devpath" | awk '/\/dev\/cciss\// { print "yes"; }'`" ; then
 		findmodule "cciss"
-	elif is_yes "`echo "$devpath" | awk '/\/dev\/ataraid\// { print "yes"; }'`"; then
+		return
+	fi
+
+	if is_yes "`echo "$devpath" | awk '/\/dev\/ataraid\// { print "yes"; }'`"; then
 		find_modules_ide
 		findmodule "ataraid"
 		ataraidmodules="`awk '/ataraid_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
@@ -581,8 +608,11 @@
 		for n in $ataraidmodules; do
 			findmodule "$n"
 		done
+		return
+	fi
+
 	# check to see if we need to set up a loopback filesystem
-	elif is_yes "`echo "$devpath" | awk -F/ '{print($3);}' | awk '/loop/ { print "yes"; }'`" ; then
+	if is_yes "`echo "$devpath" | awk -F/ '{print($3);}' | awk '/loop/ { print "yes"; }'`" ; then
 		die "Sorry, root on loop device isn't supported."
 		# TODO: rewrite for bsp and make nfs ready
 		if [ ! -x /sbin/losetup ]; then
@@ -601,7 +631,10 @@
 		BASICMODULES="$BASICMODULES -loop"
 		findmodule "-$loopFs"
 		BASICMODULES="$BASICMODULES -${loopFs}"
-	elif _check_lvm "$devpath"; then
+		return
+	fi
+
+	if _check_lvm "$devpath"; then
 		node="$devpath"
 
 		if [ ! -f /sbin/initrd-lvm -o ! -x /sbin/lvdisplay -o ! -x /sbin/pvdisplay ] ; then
@@ -634,6 +667,7 @@
 		fi
 		debug "LVM $LVMTOOLSVERSION enabled"
 		uselvm="yes"
+		return
 	fi
 }
 
@@ -1202,8 +1236,6 @@
 }
 
 initrd_gen_multipath() {
-	set -x
-
 	inst_d /proc /sys /sbin /lib/udev
 #	inst /sbin/multipathd /sbin
 	inst /sbin/kpartx /sbin


More information about the pld-cvs-commit mailing list