[readonly/geninitrd: 455/1068] - find_modules_for(): allow fallback if primary condition succeeded

draenog draenog at pld-linux.org
Sat Nov 2 19:50:37 CET 2013


commit d91797776e13bf1c2d5d7133aa3472bedffafcd6
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Wed Oct 24 15:53:33 2007 +0000

    - find_modules_for(): allow fallback if primary condition succeeded
    
    svn-id: @8851

 geninitrd | 56 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 44 insertions(+), 12 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index c63c0e6..7797522 100755
--- a/geninitrd
+++ b/geninitrd
@@ -538,13 +538,29 @@ find_modules_for() {
 		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 @@ find_modules_for() {
 
 		# 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 @@ find_modules_for() {
 		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 @@ find_modules_for() {
 		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 @@ find_modules_for() {
 		fi
 		debug "LVM $LVMTOOLSVERSION enabled"
 		uselvm="yes"
+		return
 	fi
 }
 
@@ -1202,8 +1236,6 @@ initrd_gen_udev() {
 }
 
 initrd_gen_multipath() {
-	set -x
-
 	inst_d /proc /sys /sbin /lib/udev
 #	inst /sbin/multipathd /sbin
 	inst /sbin/kpartx /sbin
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/147754ca159d40ca5eb541074dc043d8cbd92090



More information about the pld-cvs-commit mailing list