SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Tue Oct 23 17:06:56 CEST 2007


Author: glen
Date: Tue Oct 23 17:06:56 2007
New Revision: 8839

Modified:
   geninitrd/trunk/geninitrd
Log:
- inst() adds now $MNTIMAGE automatically

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Tue Oct 23 17:06:56 2007
@@ -266,11 +266,10 @@
 
 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 @@
 	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 @@
 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 @@
 	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 @@
 		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 @@
 			/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 @@
 
 	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 @@
 		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 @@
 			[ -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 @@
 
 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 @@
 		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 @@
 
 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 @@
 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"


More information about the pld-cvs-commit mailing list