[readonly/geninitrd: 440/1068] - use dmraid devices only for rootfs - generate dmraid portion only if dmraid devices are found

draenog draenog at pld-linux.org
Sat Nov 2 19:49:21 CET 2013


commit f155a80b1b4dbbf1009bf170fbab02c7829d3b09
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Thu Oct 11 15:30:04 2007 +0000

    - use dmraid devices only for rootfs
    - generate dmraid portion only if dmraid devices are found
    
    svn-id: @8812

 geninitrd | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 215d68f..49cae87 100755
--- a/geninitrd
+++ b/geninitrd
@@ -59,6 +59,8 @@ PROBESTATICMODULES=no
 tmpfs_dev=no
 # is /proc/devices entries already created
 proc_partitions=no
+# dmraid component devices of rootfs is on dmraid
+dmraid_devices=''
 
 if [ -f /etc/udev/udev.conf -a -x /sbin/initrd-udevd ]; then
 	USE_UDEV="yes"
@@ -89,7 +91,7 @@ usage () {
 }
 
 debug() {
-	[ -n "$verbose" ] && echo "$*"
+	[ -n "$verbose" ] && echo >&2 "$*"
 }
 
 # aborts program abnormally
@@ -540,6 +542,7 @@ find_modules_for() {
 		blockdev=${blockdev#/dev/mapper/}
 		for node in $(dmraid -r -cdevpath,raidname |awk -F, -vv="$blockdev" '{if ($2 == v) print $1}'); do
 			find_modules_for $node
+			dmraid_devices="$dmraid_devices $node"
 		done
 
 		# XXX probably should detect
@@ -1362,17 +1365,15 @@ initrd_gen_lvm() {
 		if is_yes "$raidfound"; then
 			echo "	md_component_detection = 1" >> "$MNTIMAGE/etc/lvm.conf"
 		fi
-		if is_yes "$USE_DMRAID"; then
+		if [ "$dmraid_devices" ]; then
 			echo '	types = [ "device-mapper", 254 ]' >> "$MNTIMAGE/etc/lvm.conf"
 			# ignore /dev/sd* devices that dmraid consists
-  			local devs=$(dmraid -r | awk -F: '{print $1}')
-			if [ "$devs" ]; then
 				echo '	filter = [' >> "$MNTIMAGE/etc/lvm.conf"
-				for dev in $devs; do
+				for dev in $dmraid_devices; do
+					debug "dmraid: ignoring $dev from LVM"
 					printf '  "r|^%s.*|",\n' $dev
 				done >> "$MNTIMAGE/etc/lvm.conf"
 				echo ']' >> "$MNTIMAGE/etc/lvm.conf"
-			fi
 		fi
 		lvm dumpconfig | awk '/filter=/' >> "$MNTIMAGE/etc/lvm.conf"
 		echo "}" >> "$MNTIMAGE/etc/lvm.conf"
@@ -1438,7 +1439,7 @@ if is_yes "$USE_SUSPEND2"; then
 	initrd_gen_suspend2
 fi
 
-if is_yes "$USE_DMRAID"; then
+if [ "$dmraid_devices" ]; then
 	initrd_gen_dmraid
 fi
 
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list