SVN: geninitrd/trunk: TODO geninitrd

glen glen at pld-linux.org
Tue Feb 6 17:59:42 CET 2007


Author: glen
Date: Tue Feb  6 17:59:42 2007
New Revision: 8225

Modified:
   geninitrd/trunk/TODO
   geninitrd/trunk/geninitrd
Log:
- use blkid optionally (but preferred) to resolve UUID= and LABEL= at initrd generation time

Modified: geninitrd/trunk/TODO
==============================================================================
--- geninitrd/trunk/TODO	(original)
+++ geninitrd/trunk/TODO	Tue Feb  6 17:59:42 2007
@@ -16,6 +16,5 @@
 - missing module are not critical (but write big warning about this)
 - add cryptofs on rootfs
 - finish dmraid support
-- use blkid to resolve UUID and LABEL
 - support UUID and LABEL for root= kernel commandline option from initrd
 - tmpfs /dev hints from: https://wiki.ubuntu.com/ReplacementInit

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Tue Feb  6 17:59:42 2007
@@ -238,6 +238,23 @@
 	eval `awk '/^[\t ]*#/ {next} {if ( $2 == "/" ) {print "rootdev=\"" $1 "\"\nrootFs=\"" $3 "\""}}' $fstab`
 	case $rootdev in
 	LABEL=*)
+		# new way, using blkid
+		if [ -x /sbin/blkid ]; then
+			label=${rootdev#"LABEL="}
+			dev=$(/sbin/blkid -t LABEL="$label" -o device)
+
+			if [ "$dev" -a -r "$dev" ]; then
+				debug "Using $dev as device for rootfs"
+				rootdev=$dev
+				rootdev_found=1
+				rootdev1=${rootdev} # XXX neccessary?
+				return
+			fi
+			echo >&2 "geninitrd can't find real device for LABEL=$label"
+			exit 1
+		fi
+
+		# old way, using various tools
 		if [ -x /sbin/findfs -a \( "$rootFs." = "ext2." -o "$rootFs." = "ext3." \) ] ; then
 			rootdev2="`/sbin/findfs $rootdev 2>/dev/null`"
 			if [ -n "$rootdev2" ] ; then
@@ -286,6 +303,23 @@
 		fi
 		;;
 	UUID=*)
+		# new way, using blkid
+		if [ -x /sbin/blkid ]; then
+			uuid=${rootdev#"UUID="}
+			dev=$(/sbin/blkid -t UUID="$uuid" -o device)
+
+			if [ "$dev" -a -r "$dev" ]; then
+				debug "Using $dev as device for rootfs"
+				rootdev=$dev
+				rootdev_found=1
+				rootdev1=${rootdev} # XXX neccessary?
+				return
+			fi
+			echo >&2 "geninitrd can't find real device for UUID=$uuid"
+			exit 1
+		fi
+
+		# old way, using various tools
 		if [ -x /sbin/findfs -a \( "$rootFs." = "ext2." -o "$rootFs." = "ext3." \) ] ; then
 			rootdev2="`/sbin/findfs $rootdev 2>/dev/null`"
 			if [ -n "$rootdev2" ] ; then


More information about the pld-cvs-commit mailing list