]> git.proxmox.com Git - grub2.git/commitdiff
2008-06-26 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Thu, 26 Jun 2008 07:03:26 +0000 (07:03 +0000)
committerrobertmh <robertmh@localhost>
Thu, 26 Jun 2008 07:03:26 +0000 (07:03 +0000)
        * util/grub.d/10_linux.in: Avoid passing UUIDs to Linux when either
        "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" does not exist, or when a
        Linux image includes no initrd.

ChangeLog
util/grub.d/10_linux.in

index 7f288a1bb63b2c858bda0f5430114fdffdf17852..d5aa52455e306c73db164107956bce06257abc8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-26  Robert Millan  <rmh@aybabtu.com>
+
+       * util/grub.d/10_linux.in: Avoid passing UUIDs to Linux when either
+       "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" does not exist, or when a
+       Linux image includes no initrd.
+
 2008-06-21  Javier Martín  <lordhabbit@gmail.com>
 
        * util/i386/pc/grub-setup.c (setup): Remove literal "core.img" in a
index 6ee705ba087d3b183f1f707a1bdfb5295b23d4ad..2512bd26e247b21894c2e067f89604cd9e4a6c43 100644 (file)
@@ -27,17 +27,17 @@ else
   OS="${GRUB_DISTRIBUTOR} GNU/Linux"
 fi
 
-if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] ; then
-  # loop-AES arranges things so that /dev/loop/X can be our root device, but
-  # the initrds that Linux uses don't like that.
-  case ${GRUB_DEVICE} in
-    /dev/loop/*|/dev/loop[0-9])
-      LINUX_ROOT_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
-    ;;
-    *)
-      LINUX_ROOT_DEVICE=${GRUB_DEVICE}
-    ;;
-  esac
+# loop-AES arranges things so that /dev/loop/X can be our root device, but
+# the initrds that Linux uses don't like that.
+case ${GRUB_DEVICE} in
+  /dev/loop/*|/dev/loop[0-9])
+    GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
+  ;;
+esac
+
+if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
+    || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
+  LINUX_ROOT_DEVICE=${GRUB_DEVICE}
 else
   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
 fi
@@ -109,6 +109,7 @@ while [ "x$list" != "x" ] ; do
   rel_dirname=`make_system_path_relative_to_its_root $dirname`
   version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
   alt_version=`echo $version | sed -e "s,\.old$,,g"`
+  linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
 
   initrd=
   for i in "initrd.img-${version}" "initrd-${version}.img" \
@@ -120,11 +121,14 @@ while [ "x$list" != "x" ] ; do
   done
   if test -n "${initrd}" ; then
     echo "Found initrd image: ${dirname}/${initrd}" >&2
+  else
+    # "UUID=" magic is parsed by initrds.  Since there's no initrd, it can't work here.
+    linux_root_device_thisversion=${GRUB_DEVICE}
   fi
 
   cat << EOF
 menuentry "${OS}, linux ${version}" {
-       linux   ${rel_dirname}/${basename} root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
+       linux   ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
 EOF
   if test -n "${initrd}" ; then
     cat << EOF
@@ -137,7 +141,7 @@ EOF
 
   cat << EOF
 menuentry "${OS}, linux ${version} (single-user mode)" {
-       linux   ${rel_dirname}/${basename} root=${LINUX_ROOT_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
+       linux   ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro single ${GRUB_CMDLINE_LINUX}
 EOF
   if test -n "${initrd}" ; then
     cat << EOF