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