]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
- use blkid optionally (but preferred) to resolve UUID= and LABEL= at initrd generati...
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 6 Feb 2007 16:59:42 +0000 (16:59 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Tue, 6 Feb 2007 16:59:42 +0000 (16:59 +0000)
svn-id: @8225

TODO
geninitrd

diff --git a/TODO b/TODO
index a19f39d8d2da00b4d52b399ed7c93d0c9c66ffe5..404eb391bac9ee2e336977912a9ba23af60beb10 100644 (file)
--- a/TODO
+++ b/TODO
@@ -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
index bf58ddc61c310faf5678930dfc5eb3bca1cb1071..3d2ef570670267ced8da28ca5151ed81f8f73aa8 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -238,6 +238,23 @@ find_root() {
        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 @@ find_root() {
                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
This page took 0.293501 seconds and 4 git commands to generate.