SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Thu Oct 11 17:30:04 CEST 2007


Author: glen
Date: Thu Oct 11 17:30:04 2007
New Revision: 8812

Modified:
   geninitrd/trunk/geninitrd
Log:
- use dmraid devices only for rootfs
- generate dmraid portion only if dmraid devices are found

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Thu Oct 11 17:30:04 2007
@@ -59,6 +59,8 @@
 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 @@
 }
 
 debug() {
-	[ -n "$verbose" ] && echo "$*"
+	[ -n "$verbose" ] && echo >&2 "$*"
 }
 
 # aborts program abnormally
@@ -540,6 +542,7 @@
 		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 @@
 		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 @@
 	initrd_gen_suspend2
 fi
 
-if is_yes "$USE_DMRAID"; then
+if [ "$dmraid_devices" ]; then
 	initrd_gen_dmraid
 fi
 


More information about the pld-cvs-commit mailing list