SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Wed Oct 31 18:44:07 CET 2007


Author: glen
Date: Wed Oct 31 18:44:07 2007
New Revision: 8916

Modified:
   geninitrd/trunk/geninitrd
Log:
- avoid lvdisplay errors killing whole /linuxrc

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Wed Oct 31 18:44:07 2007
@@ -197,7 +197,11 @@
 
 # unmount all mountpoints mounted by geninitrd
 umount_all() {
-	echo 'debugshell' | add_linuxrc
+
+	add_linuxrc <<-'EOF'
+	: Last shell before umounting all and giving control over to real init
+	debugshell
+	EOF
 
 	if is_yes "$dev_mounted"; then
 		echo 'umount /dev' | add_linuxrc
@@ -1663,8 +1667,12 @@
 		initrd_gen_devices
 
 		add_linuxrc <<-EOF
+			export LVM_ROOTDEV=$rootdev
+			export LVM_VGVOLUME=$VGVOLUME
+		EOF
+		add_linuxrc <<-'EOF'
 			# disable noise from lvm accessing devices that aren't ready.
-			printk=\$(cat /proc/sys/kernel/printk)
+			printk=$(cat /proc/sys/kernel/printk)
 			echo 0 > /proc/sys/kernel/printk
 
 			export LVM_SYSTEM_DIR=/tmp
@@ -1672,19 +1680,22 @@
 			lvm vgscan --mknodes --ignorelockingfailure 2>/dev/null
 
 			: 'Activating Volume Groups'
-			lvm vgchange --ignorelockingfailure -a y $VGVOLUME 2>/dev/null
+			lvm vgchange --ignorelockingfailure -a y $LVM_VGVOLUME 2>/dev/null
 
-			echo "\$printk" > /proc/sys/kernel/printk
+			echo "$printk" > /proc/sys/kernel/printk
 
 			# Find out major/minor
-			majmin="\$(lvm lvdisplay --ignorelockingfailure -c $rootdev 2>/dev/null)"
-			majmin="\${majmin#*/}"
-			majmin="\${majmin#*:*:*:*:*:*:*:*:*:*:*:*}"
-			major="\${majmin%:*}"
-			minor="\${majmin#*:}"
-			# Pass it to kernel
-			val=\$((256 * \$major + \$minor))
-			echo \$val > /proc/sys/kernel/real-root-dev
+			attrs="$(lvm lvdisplay --ignorelockingfailure -c $LVM_ROOTDEV 2>/dev/null)"
+			if [ "$attrs" ]; then
+				majmin="${attrs#*/}"
+				majmin="${majmin#*:*:*:*:*:*:*:*:*:*:*:*}"
+				major="${majmin%:*}"
+				minor="${majmin#*:}"
+			fi
+			if [ "$major" -a "$minor" ]; then
+				# Pass it to kernel
+				echo $((256 * $major + $minor)) > /proc/sys/kernel/real-root-dev
+			fi
 		EOF
 	fi
 }


More information about the pld-cvs-commit mailing list