[readonly/geninitrd: 471/1068] - try activating only dm-multipath rootfs is on - inst_exec: install execs to $dest and libraries to

draenog draenog at pld-linux.org
Sat Nov 2 19:51:59 CET 2013


commit 9b532fe674cd73b875dd7f274ff3931db1e44bdd
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Thu Oct 25 09:59:09 2007 +0000

    - try activating only dm-multipath rootfs is on
    - inst_exec: install execs to $dest and libraries to $libdir
    - inst() debug is back
    
    svn-id: @8870

 geninitrd | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index c2ab1de..5e1cd72 100755
--- a/geninitrd
+++ b/geninitrd
@@ -57,6 +57,8 @@ proc_partitions=no
 
 # 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_md=no
 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 @@ inst() {
 	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 @@ inst_exec() {
 		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 @@ find_modules_multipath() {
 	# 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_udev() {
 }
 
 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 @@ EOF
 	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
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list