[readonly/geninitrd: 448/1068] - inst() adds now $MNTIMAGE automatically

draenog draenog at pld-linux.org
Sat Nov 2 19:50:02 CET 2013


commit 1775ba37773772a67a99cb479fc186769f225975
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Tue Oct 23 15:06:56 2007 +0000

    - inst() adds now $MNTIMAGE automatically
    
    svn-id: @8839

 geninitrd | 55 +++++++++++++++++++++++++++----------------------------
 1 file changed, 27 insertions(+), 28 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index bb6cf71..8db8cb1 100755
--- a/geninitrd
+++ b/geninitrd
@@ -266,11 +266,10 @@ findmodule() {
 
 inst() {
 	if [ "$#" != "2" ];then
-		echo >&2 "usage: inst <file> <destination>"
-		return
+		die 'Usage: inst <file> $MNTIMAGE<destination>'
 	fi
-	debug "$1 -> $2"
-	cp -HR "$1" "$2"
+	debug "$1 -> $MNTIMAGE$2"
+	cp -HR "$1" "$MNTIMAGE$2"
 }
 
 find_modules_softraid() {
@@ -643,7 +642,7 @@ EOF
 	fi
 
 	for firmware in $firmware_files; do
-		inst "/lib/firmware/$firmware" "$MNTIMAGE/lib/firmware/$firmware"
+		inst "/lib/firmware/$firmware" "/lib/firmware/$firmware"
 	done
 
 	echo "mount -t proc none /proc" >> "$linuxrc"
@@ -1050,12 +1049,12 @@ mkdir "$MNTIMAGE/dev/shm"
 s="$RCFILE"
 ln -s /linuxrc $MNTIMAGE/init
 
-inst /bin/initrd-busybox "$MNTIMAGE/bin/initrd-busybox"
-ln -s initrd-busybox "$MNTIMAGE/bin/sh"
-ln -s initrd-busybox "$MNTIMAGE/bin/busybox" # for older busyboxes who had /bin/busybox as EXEPATH
+inst /bin/initrd-busybox "/bin/initrd-busybox"
+ln -s initrd-busybox "/bin/sh"
+ln -s initrd-busybox "/bin/busybox" # for older busyboxes who had /bin/busybox as EXEPATH
 
-if is_yes "$USEINSMODSTATIC" ; then
-	inst "$INSMOD" $MNTIMAGE/bin/insmod.static
+if is_yes "$USEINSMODSTATIC"; then
+	inst "$INSMOD" /bin/insmod.static
 fi
 
 cat > "$s" <<'EOF'
@@ -1092,10 +1091,10 @@ initrd_gen_suspend() {
 	mkdir -p $MNTIMAGE/etc
 	mkdir -p $MNTIMAGE/dev
 	resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
-	inst /dev/snapshot $MNTIMAGE/dev
-	inst $resume_dev $MNTIMAGE/dev
-	inst /etc/suspend.conf $MNTIMAGE/etc/suspend.conf
-	inst /usr/sbin/resume "$MNTIMAGE/bin/resume"
+	inst /dev/snapshot /dev
+	inst $resume_dev /dev
+	inst /etc/suspend.conf /etc/suspend.conf
+	inst /usr/sbin/resume "/bin/resume"
 	echo "resume" >> "$s"
 }
 
@@ -1156,8 +1155,8 @@ initrd_gen_udev() {
 		die "/sbin/initrd-udevd not present"
 	fi
 
-	inst /sbin/initrd-udevd $MNTIMAGE/sbin/udevd
-	inst /etc/udev/udev.conf $MNTIMAGE/etc/udev/udev.conf
+	inst /sbin/initrd-udevd /sbin/udevd
+	inst /etc/udev/udev.conf /etc/udev/udev.conf
 
 	if is_yes "$USE_UDEV"; then
 		initrd_gen_tmpfs_dev
@@ -1168,8 +1167,8 @@ initrd_gen_udev() {
 			/sbin/udevd --daemon
 		EOF
 		if is_yes "$PROBESTATICMODS"; then
-			inst /sbin/initrd-udevtrigger $MNTIMAGE/sbin/udevtrigger
-			inst /sbin/initrd-udevsettle $MNTIMAGE/sbin/udevsettle
+			inst /sbin/initrd-udevtrigger /sbin/udevtrigger
+			inst /sbin/initrd-udevsettle /sbin/udevsettle
 			cat >> "$s" <<-'EOF'
 				/sbin/udevtrigger
 				/sbin/udevsettle
@@ -1195,7 +1194,7 @@ initrd_gen_dmraid() {
 
 	mkdir -p "$MNTIMAGE/sbin"
 	mkdir -p "$MNTIMAGE/sys"
-	inst /sbin/dmraid-initrd $MNTIMAGE/sbin/dmraid
+	inst /sbin/dmraid-initrd /sbin/dmraid
 	cat <<-EOF >> "$s"
 	mount -t proc none /proc
 	mount -t sysfs none /sys
@@ -1241,7 +1240,7 @@ initrd_gen_softraid() {
 		die "/sbin/mdadm or /sbin/initrd-mdassemble is missing!"
 	fi
 
-	inst /sbin/initrd-mdassemble "$MNTIMAGE/bin/mdassemble"
+	inst /sbin/initrd-mdassemble "/bin/mdassemble"
 
 	# LVM on RAID case
 	dev_list_extra=$(awk '/^DEVICE / { for (i=2; i<=NF; i++) { printf "%s ", $i; }; } ' /etc/mdadm.conf)
@@ -1271,7 +1270,7 @@ initrd_gen_softraid() {
 			[ -e "$MNTIMAGE/$f" ] && continue
 			debug echo "copying $f"
 			# this works fine with and without devfs
-			inst $f $MNTIMAGE/$f
+			inst $f $f
 		done
 	done
 
@@ -1333,7 +1332,7 @@ EOF
 
 initrd_gen_lvm() {
 	debug "Adding LVM support to initrd"
-	inst /sbin/initrd-lvm $MNTIMAGE/bin/lvm
+	inst /sbin/initrd-lvm /bin/lvm
 	mkdir -p $MNTIMAGE/etc
 	mkdir -p $MNTIMAGE/tmp
 	mkdir -p $MNTIMAGE/proc
@@ -1350,7 +1349,7 @@ initrd_gen_lvm() {
 		for device in $PVDEVICES; do
 			# if LVM on RAID then device might be copied already in gen_softraid
 			[ -e "$MNTIMAGE/dev/$(basename $device)" ] && continue
-			inst $device $MNTIMAGE/dev/
+			inst $device /dev
 		done
 	fi
 	echo "mount -t proc none /proc" >> "$s"
@@ -1452,14 +1451,14 @@ fi
 
 if is_yes "$usenfs" ; then
 	initrd_gen_nfs
-elif is_yes "$USERAIDSTART" && is_yes "$raidfound" ; then
+elif is_yes "$USERAIDSTART" && is_yes "$raidfound"; then
 	initrd_gen_softraid
-	if is_yes "$uselvm" ; then
+	if is_yes "$uselvm"; then
 		initrd_gen_lvm
 	else
 		initrd_gen_procdata
 	fi
-elif is_yes "$uselvm" ; then
+elif is_yes "$uselvm"; then
 	initrd_gen_lvm
 else
 	initrd_gen_procdata
@@ -1474,11 +1473,11 @@ EOF
 fi
 
 # additional devs always needed
-[ ! -e "$MNTIMAGE/$rootdev_add" ] && inst $rootdev_add $MNTIMAGE/dev
+[ ! -e "$MNTIMAGE/$rootdev_add" ] && inst $rootdev_add /dev
 
 if [ "$INITRDFS" = "initramfs" ]; then
 	mkdir -p $MNTIMAGE/newroot
-	[ ! -e "$MNTIMAGE/$rootdev" ] && inst $rootdev $MNTIMAGE/dev
+	[ ! -e "$MNTIMAGE/$rootdev" ] && inst $rootdev /dev
 	# Parsing root parameter
 	# We support passing root as hda3 /dev/hda3 0303 0x0303 and 303
 	cat << 'EOF' >> "$s"
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list