[readonly/geninitrd: 470/1068] - add inst_exec() to copy executable and it's shared libs - use it in initrd_gen_multipath

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


commit 209061e3adc77a78d5ff7108b2ff050ec060d24a
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Thu Oct 25 08:56:24 2007 +0000

    - add inst_exec() to copy executable and it's shared libs
    - use it in initrd_gen_multipath
    
    svn-id: @8869

 geninitrd | 44 +++++++++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 23 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 909a19e..c2ab1de 100755
--- a/geninitrd
+++ b/geninitrd
@@ -295,6 +295,23 @@ inst_d() {
 	done
 }
 
+# install executable and it's shared libraries
+inst_exec() {
+	local src i=0 c=$(($# - 1))
+	while [ $i -lt $c ]; do
+		src="$src $1"
+		i=$((i + 1))
+		shift
+	done
+	dest=$1
+	set -- $src
+
+	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
+	done
+}
+
 # output modules.conf / modprobe.conf
 modprobe_conf() {
 	echo "$modprobe_conf_cache"
@@ -1315,30 +1332,11 @@ initrd_gen_udev() {
 
 initrd_gen_multipath() {
 	inst_d /proc /sys /sbin /lib/udev
-#	inst /sbin/multipathd /sbin
-	inst /sbin/kpartx /sbin
-#	inst /bin/mountpoint /bin
-#	inst /sbin/devmap_name /sbin
-	inst /sbin/multipath /sbin
+	inst_exec /sbin/kpartx /sbin
+	inst_exec /sbin/multipath /sbin
 	# for udev callouts
-	inst /sbin/scsi_id /lib/udev
-	for a in /sbin/mpath*; do
-	   inst $a /sbin
-	done
-
-	if [ -d /lib64 ]; then
-		lib=/lib64
-	else
-		lib=/lib
-	fi
-	inst_d $lib
-	inst /lib64/ld-linux-x86-64.so.2 $lib
-	for a in $(ldd /sbin/kpartx /sbin/multipath | grep -v linux-gate.so | sort -u | awk '{print $3}'); do
-	   	inst $a $lib
-	done
-	for a in $(ldd $MNTIMAGE$lib/lib* | grep -v linux-gate.so | sort -u | awk '{print $3}'); do
-	   	inst $a $lib
-	done
+	inst_exec /sbin/scsi_id /lib/udev
+	inst_exec /sbin/mpath* /sbin
 
 	cat <<-'EOF' >> "$s"
 	mount -t proc none /proc
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list