I've implemented a patch now that will translate LABEL and UUID from
/etc/fstab into a proper device string.  Joey, can you please review
it.  (FWIW, it's tested and seems to work for me.)

Index: nslu2
===================================================================
--- nslu2       (revision 98)
+++ nslu2       (working copy)
@@ -67,7 +67,41 @@
 # Record the root filesystem device for use during boot, since the slug's
 # bootloader is hardcoded to use roo=/dev/ram.
 rootdev=$(egrep '^[^   ]*[     ]*/[    ]' /etc/fstab | awk '{print $1}') || 
true
-if [ -z "$rootdev" ]; then
+
+# Translate LABEL and UUID entries into a proper device name.
+if echo "$rootdev" | grep -q "="; then
+       a=$(echo "$rootdev" | cut -d "=" -f 1)
+       b=$(echo "$rootdev" | cut -d "=" -f 2)
+       case "$a" in
+               LABEL)
+                       # Not all labels show up in /dev/disk/by-label:
+                       # e.g. LABEL=/ doesn't.
+                       found=0
+                       if [ -e /dev/disk/by-label ]; then
+                               for i in $(ls -1 /dev/disk/by-label/); do
+                                       [ "$i" = "$b" ] && found=1
+                               done
+                       fi
+                       if [ $found -eq 0 ]; then
+                               echo "/etc/fstab parse error; $rootdev not 
supported or found" >&2
+                               rootdev=/dev/sda1
+                               pause_error
+                       else
+                               rootdev="/dev/disk/by-label/$b"
+                       fi
+               ;;
+               UUID)
+                       rootdev=/dev/disk/by-uuid/$b
+               ;;
+               *)
+                       echo "/etc/fstab parse error; cannot recognize root 
$rootdev" >&2
+                       rootdev=/dev/sda1
+                       pause_error
+               ;;
+       esac
+fi
+
+if [ ! -e "$rootdev" ]; then
        rootdev=/dev/sda1
        echo "Warning: /etc/fstab parse error; guessing that the root device is 
$rootdev" >&2
 fi

-- 
Martin Michlmayr
http://www.cyrius.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to