templates: Add GRUB_DISABLE_UUID
The grub-mkconfig and 10_linux scripts by default attempt to use a UUID to set the root kernel command line parameter and the $root GRUB environment variable. The former can be disabled by setting the GRUB_DISABLE_LINUX_UUID variable to "true", but there is currently no way to disable the latter. The generated grub config uses the search command with the --fs-uuid option to find the device that has to be set as $root, i.e: search --no-floppy --fs-uuid --set=root ... This is usually more reliable but in some cases it may not be appropriate, so this patch introduces a new GRUB_DISABLE_UUID variable that can be used to disable searching for the $root device by filesystem UUID. When disabled, the $root device will be set to the value specified in the device.map as found by the grub-probe --target=compatibility_hint option. When setting GRUB_DISABLE_UUID=true, the GRUB_DISABLE_LINUX_UUID and GRUB_DISABLE_LINUX_PARTUUID variables will also be set to "true" unless these have been explicitly set to "false". That way, the GRUB_DISABLE_UUID variable can be used to force using the device names for both GRUB and Linux. Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Reviewed-by: Nicholas Vinson <nvinson234@gmail.com>
This commit is contained in:
parent
33203ca348
commit
b78d570a36
3 changed files with 21 additions and 2 deletions
|
@ -156,7 +156,7 @@ prepare_grub_to_access_device ()
|
|||
if [ "x$fs_hint" != x ]; then
|
||||
echo "set root='$fs_hint'"
|
||||
fi
|
||||
if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
|
||||
if [ "x${GRUB_DISABLE_UUID}" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
|
||||
hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints=
|
||||
echo "if [ x\$feature_platform_search_hint = xy ]; then"
|
||||
echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
|
||||
|
@ -173,7 +173,7 @@ grub_get_device_id ()
|
|||
IFS='
|
||||
'
|
||||
device="$1"
|
||||
if fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
|
||||
if [ "x${GRUB_DISABLE_UUID}" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
|
||||
echo "$fs_uuid";
|
||||
else
|
||||
echo $device |sed 's, ,_,g'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue