SVN: geninitrd/trunk: functions geninitrd

arekm arekm at pld-linux.org
Tue Apr 3 12:18:56 CEST 2007


Author: arekm
Date: Tue Apr  3 12:18:55 2007
New Revision: 8409

Modified:
   geninitrd/trunk/functions
   geninitrd/trunk/geninitrd
Log:
Create additional devices like xfs logdev. Verbose copying of devices.

Modified: geninitrd/trunk/functions
==============================================================================
--- geninitrd/trunk/functions	(original)
+++ geninitrd/trunk/functions	Tue Apr  3 12:18:55 2007
@@ -9,18 +9,23 @@
 # 
 # Sets global variables:
 # - $rootdev
+# - $rootdev_add
 # - $rootFS
 #
 find_root() {
 	local fstab="$1"
 	local function="${PROGRAM:+$PROGRAM: }find_root"
+	local rootopt
 
-	eval $(awk '/^[\t ]*#/ {next} {if ( $2 == "/" ) {print "rootdev=\"" $1 "\"\nrootFs=\"" $3 "\""}}' $fstab)
+	eval $(awk '/^[\t ]*#/ {next} {if ( $2 == "/" ) {print "rootdev=\"" $1 "\"\nrootFs=\"" $3 "\"\nrootopt=\"" $4 "\""}}' $fstab)
 	if [ -z "$rootdev" ]; then
 		echo >&2 "$function: can't find real device for rootfs"
 		return 1
 	fi
 
+	# additional devices needed (xfs logdev)
+	rootdev_add=$(echo "$rootopt" | awk -F',' '{ for (i=1; i<=NF; i++) { if ($i ~ /^logdev=/) { gsub(/^logdev=/, NIL, $i); print $i; } } }')
+
 	case $rootdev in
 	LABEL=*)
 		if [ ! -x /sbin/blkid ]; then

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Tue Apr  3 12:18:55 2007
@@ -252,7 +252,7 @@
 		return
 	fi
 	debug "$1 -> $2"
-	cp "$1" "$2"
+	cp -HR "$1" "$2"
 }
 
 find_modules_softraid() {
@@ -958,6 +958,7 @@
 debug "Using $rootdev as device for rootfs"
 
 find_modules_for "$rootdev"
+[ -n "$rootdev_add" ] && find_modules_for "$rootdev_add"
 
 findmodule "-$rootFs"
 
@@ -1057,7 +1058,7 @@
 	mkdir -p $MNTIMAGE/etc
 	mkdir -p $MNTIMAGE/dev
 	resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
-	cp -HR /dev/snapshot $resume_dev $MNTIMAGE/dev
+	inst /dev/snapshot $resume_dev $MNTIMAGE/dev
 	inst /etc/suspend.conf $MNTIMAGE/etc/suspend.conf
 	inst /usr/sbin/resume "$MNTIMAGE/bin/resume"
 	echo "resume" >> "$s"
@@ -1202,7 +1203,7 @@
 			[ -e "$MNTIMAGE/$f" ] && continue
 			debug echo "copying $f"
 			# this works fine with and without devfs
-			cp -HR $f $MNTIMAGE/$f
+			inst $f $MNTIMAGE/$f
 		done
 	done
 
@@ -1281,7 +1282,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
-			cp -HR $device $MNTIMAGE/dev/
+			inst $device $MNTIMAGE/dev/
 		done
 	fi
 	echo "mount -t proc none /proc" >> "$s"
@@ -1395,9 +1396,12 @@
 	initrd_gen_procdata
 fi
 
+# additional devs always needed
+[ ! -e "$MNTIMAGE/$rootdev_add" ] && inst $rootdev_add $MNTIMAGE/dev
+
 if [ "$INITRDFS" = "initramfs" ]; then
 	mkdir -p $MNTIMAGE/newroot
-	[ ! -e "$MNTIMAGE/$rootdev" ] && cp -HR $rootdev $MNTIMAGE/dev
+	[ ! -e "$MNTIMAGE/$rootdev" ] && inst $rootdev $MNTIMAGE/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