Blame SOURCES/0149-Add-GRUB_DISABLE_UUID.patch

d41074
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a85e8e
From: Peter Jones <pjones@redhat.com>
a85e8e
Date: Thu, 4 Sep 2014 16:49:25 -0400
d41074
Subject: [PATCH] Add GRUB_DISABLE_UUID.
a85e8e
a85e8e
This will cause "search --fs-uuid --set=root ..." not to be generated by
a85e8e
grub2-mkconfig, and instead simply attempt to use the grub device name
a85e8e
as it understands it.
a85e8e
a85e8e
Good luck.
a85e8e
a85e8e
Resolves: rhbz#1027833
a85e8e
Signed-off-by: Peter Jones <pjones@redhat.com>
a85e8e
---
a85e8e
 docs/grub.texi            |  7 +++++++
a85e8e
 util/grub-mkconfig.in     | 12 ++++++++++--
a85e8e
 util/grub-mkconfig_lib.in |  4 ++--
a85e8e
 3 files changed, 19 insertions(+), 4 deletions(-)
a85e8e
a85e8e
diff --git a/docs/grub.texi b/docs/grub.texi
d41074
index 46b9e7f8e31..6b112c18804 100644
a85e8e
--- a/docs/grub.texi
a85e8e
+++ b/docs/grub.texi
a85e8e
@@ -1409,6 +1409,13 @@ disable the use of UUIDs, set this option to @samp{true}.
a85e8e
 If this option is set to @samp{true}, disable the generation of recovery
a85e8e
 mode menu entries.
a85e8e
 
a85e8e
+@item GRUB_DISABLE_UUID
a85e8e
+Normally, @command{grub-mkconfig} will generate menu entries that use
a85e8e
+universally-unique identifiers (UUIDs) to identify various filesystems to
a85e8e
+search for files.  This is usually more reliable, but in some cases it may
a85e8e
+not be appropriate.  To disable this use of UUIDs, set this option to
a85e8e
+@samp{true}.
a85e8e
+
a85e8e
 @item GRUB_VIDEO_BACKEND
a85e8e
 If graphical video support is required, either because the @samp{gfxterm}
a85e8e
 graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
a85e8e
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
d41074
index beb22deee79..bc26e7c109e 100644
a85e8e
--- a/util/grub-mkconfig.in
a85e8e
+++ b/util/grub-mkconfig.in
a85e8e
@@ -130,11 +130,11 @@ fi
a85e8e
 
a85e8e
 # Device containing our userland.  Typically used for root= parameter.
a85e8e
 GRUB_DEVICE="`${grub_probe} --target=device /`"
a85e8e
-GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
a85e8e
+GRUB_DEVICE_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
a85e8e
 
a85e8e
 # Device containing our /boot partition.  Usually the same as GRUB_DEVICE.
a85e8e
 GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
a85e8e
-GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
a85e8e
+GRUB_DEVICE_BOOT_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
a85e8e
 
a85e8e
 # Filesystem for the device containing our userland.  Used for stuff like
a85e8e
 # choosing Hurd filesystem module.
a85e8e
@@ -148,6 +148,13 @@ if test -f ${sysconfdir}/default/grub ; then
a85e8e
   . ${sysconfdir}/default/grub
a85e8e
 fi
a85e8e
 
a85e8e
+if [ "x$GRUB_DISABLE_UUID" != "xtrue" -a -z "$GRUB_DEVICE_UUID" ]; then
a85e8e
+  GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED"
a85e8e
+fi
a85e8e
+if [ "x$GRUB_DISABLE_UUID" != "xtrue" -a -z "$GRUB_DEVICE_BOOT_UUID" ]; then
a85e8e
+  GRUB_DEVICE_BOOT_UUID="$GRUB_DEVICE_BOOT_UUID_GENERATED"
a85e8e
+fi
a85e8e
+
a85e8e
 # XXX: should this be deprecated at some point?
a85e8e
 if [ "x${GRUB_TERMINAL}" != "x" ] ; then
a85e8e
   GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}"
a85e8e
@@ -213,6 +220,7 @@ export GRUB_DEFAULT \
a85e8e
   GRUB_SERIAL_COMMAND \
a85e8e
   GRUB_DISABLE_LINUX_UUID \
a85e8e
   GRUB_DISABLE_RECOVERY \
a85e8e
+  GRUB_DISABLE_UUID \
a85e8e
   GRUB_VIDEO_BACKEND \
a85e8e
   GRUB_GFXMODE \
a85e8e
   GRUB_BACKGROUND \
a85e8e
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
d41074
index 7ac0bbed0d3..5c9ed84a5e7 100644
a85e8e
--- a/util/grub-mkconfig_lib.in
a85e8e
+++ b/util/grub-mkconfig_lib.in
a85e8e
@@ -156,7 +156,7 @@ prepare_grub_to_access_device ()
a85e8e
   if [ "x$fs_hint" != x ]; then
a85e8e
     echo "set root='$fs_hint'"
a85e8e
   fi
a85e8e
-  if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
a85e8e
+  if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
a85e8e
     hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints=
a85e8e
     echo "if [ x\$feature_platform_search_hint = xy ]; then"
a85e8e
     echo "  search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
a85e8e
@@ -173,7 +173,7 @@ grub_get_device_id ()
a85e8e
   IFS='
a85e8e
 '
a85e8e
   device="$1"
a85e8e
-  if fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
a85e8e
+  if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
a85e8e
     echo "$fs_uuid";
a85e8e
   else
a85e8e
     echo $device |sed 's, ,_,g'