SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Thu Oct 25 10:56:24 CEST 2007


Author: glen
Date: Thu Oct 25 10:56:24 2007
New Revision: 8869

Modified:
   geninitrd/trunk/geninitrd
Log:
- add inst_exec() to copy executable and it's shared libs
- use it in initrd_gen_multipath

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Thu Oct 25 10:56:24 2007
@@ -295,6 +295,23 @@
 	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_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


More information about the pld-cvs-commit mailing list