Blame SOURCES/0015-Add-GRUB_DISABLE_UUID.patch

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