SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Thu Oct 25 11:59:10 CEST 2007


Author: glen
Date: Thu Oct 25 11:59:09 2007
New Revision: 8870

Modified:
   geninitrd/trunk/geninitrd
Log:
- try activating only dm-multipath rootfs is on
- inst_exec: install execs to $dest and libraries to $libdir
- inst() debug is back

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Thu Oct 25 11:59:09 2007
@@ -57,6 +57,8 @@
 
 # LVM devices that should not be included in vgscan on initrd
 lvm_ignore_devices=''
+# LVM volume that is used for rootfs
+VGVOLUME=
 
 # if we should init NFS at boot
 have_nfs=no
@@ -68,6 +70,8 @@
 have_dmraid=no
 # if we should init dm-multipath at boot
 have_multipath=no
+# dm-multipath id which is used for rootfs
+MULTIPATH_ID=
 
 if [ -f /etc/udev/udev.conf -a -x /sbin/initrd-udevd ]; then
 	USE_UDEV=yes
@@ -283,6 +287,7 @@
 	if [ "$#" -lt "2" ];then
 		die 'Usage: inst <file> $MNTIMAGE<destination>'
 	fi
+	debug "cp $1 $MNTIMAGE$2"
 	cp -HR "$1" "$MNTIMAGE$2"
 }
 
@@ -303,12 +308,16 @@
 		i=$((i + 1))
 		shift
 	done
-	dest=$1
+	local dest=$1
 	set -- $src
 
+	inst "$@" $dest
+
 	local lib libs=$(ldd "$@" | awk '/linux-gate\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
-	for lib in $src $libs; do
-		inst $lib $dest
+	for lib in $libs; do
+		local libdir=/$(echo "$lib" | cut -d/ -f2)/
+		inst_d $libdir
+		inst $lib $libdir
 	done
 }
 
@@ -570,9 +579,9 @@
 	# remove partition, if any
 	local disk=${devpath%p[0-9]*}
 	# need only dm name
-	local id=${disk#/dev/mapper/}
+	MULTIPATH_ID=${disk#/dev/mapper/}
 
-	local info=$(multipath -l $id)
+	local info=$(multipath -l $MULTIPATH_ID)
 	if [ -z "$info" ]; then
 		return 1
 	fi
@@ -1331,12 +1340,13 @@
 }
 
 initrd_gen_multipath() {
-	inst_d /proc /sys /sbin /lib/udev
+	inst_d /proc /sys /sbin /lib/udev /etc
 	inst_exec /sbin/kpartx /sbin
 	inst_exec /sbin/multipath /sbin
 	# for udev callouts
 	inst_exec /sbin/scsi_id /lib/udev
 	inst_exec /sbin/mpath* /sbin
+	inst /etc/multipath.conf /etc
 
 	cat <<-'EOF' >> "$s"
 	mount -t proc none /proc
@@ -1346,12 +1356,13 @@
 	initrd_gen_tmpfs_dev
 	initrd_gen_devices
 
+	echo "export multipath_id=$MULTIPATH_ID" >> "$s"
 	cat <<-'EOF' >> "$s"
-	/sbin/multipath -v 0
+	/sbin/multipath -v 0 $multipath_id
 
 	for a in /dev/mapper/*; do
 		[ $a = /dev/mapper/control ] && continue
-		kpartx -a $a
+		/sbin/kpartx -a $a
 	done
 
 	umount /sys


More information about the pld-cvs-commit mailing list