Skip to contentSkip to conversation

Add support for specifying the boot device by label

PATCH In review darkpenguin 4 participants 10 messages Sep 27, 2023 – Sep 28, 2023

lore
Share & tools
lore
#0 lore raw

cover Add support for specifying the boot device by label

Here is an updated patch that uses GRUB_ENABLE_LINUX_LABEL=true instead.

Supporting whitespace or other symbols in the label doesn't make sense until we can figure out how to properly specify them in grub.cfg - so far, nothing I've tried works (escaping, quoting, %20, \x20).

darkpenguin (2):
Allow specifying the boot device by its label instead of UUID Use GRUB_ENABLE_LINUX_LABEL=true instead of
GRUB_DISABLE_LINUX_UUID=LABEL

 util/grub-mkconfig.in     |  1 +
 util/grub-mkconfig_lib.in | 14 +++++++++++---
 util/grub.d/10_linux.in   |  3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)
Signature · 7 lines
2.30.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

PATCH 1/2 Allow specifying the boot device by its label instead of UUID

---
 util/grub-mkconfig_lib.in | 14 +++++++++++---
 util/grub.d/10_linux.in   |  3 +++
 2 files changed, 14 insertions(+), 3 deletions(-)
util/grub-mkconfig_lib.in +11 -3
index 08953287c..bd43bc01d 100644
@@ -158,14 +158,22 @@ prepare_grub_to_access_device ()
   fi
   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=
+
+    if [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
+        && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)" ]; then
+      device="--label $(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)"
+    else
+      device="--fs-uuid ${fs_uuid}"
+    fi
+
     if [ "x$hints" != x ]; then
       echo "if [ x\$feature_platform_search_hint = xy ]; then"
-      echo "  search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
+      echo "  search --no-floppy --set=root ${hints} ${device}"
       echo "else"
-      echo "  search --no-floppy --fs-uuid --set=root ${fs_uuid}"
+      echo "  search --no-floppy --set=root ${device}"
       echo "fi"
     else
-      echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
+      echo "search --no-floppy --set=root ${device}"
     fi
   fi
   IFS="$old_ifs"
util/grub.d/10_linux.in +3 -0
index cc393be7e..d29a004e3 100644
@@ -61,6 +61,9 @@ if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] )
 elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
     || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
   LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
+elif [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
+    && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)" ]; then
+  LINUX_ROOT_DEVICE=LABEL="$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)"
 else
   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
 fi
Signature · 7 lines
2.30.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#2 lore raw

Re: [PATCH 1/2] Allow specifying the boot device by its label instead of UUID

Please don't segment patches like this showing 2 solutions. Just have the patch for the agreed solution

Quoted 49 lines · darkpenguin
---
 util/grub-mkconfig_lib.in | 14 +++++++++++---
 util/grub.d/10_linux.in   |  3 +++
 2 files changed, 14 insertions(+), 3 deletions(-)
util/grub-mkconfig_lib.in +0 -1
index 08953287c..bd43bc01d 100644
@@ -158,14 +158,22 @@ prepare_grub_to_access_device ()
   fi
   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=

util/grub-mkconfig_lib.in +3 -0
+
+    if [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
+        && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${fs_uuid} -s

LABEL -o value)" ]; then

util/grub-mkconfig_lib.in +8 -3
+      device="--label $(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)"
+    else
+      device="--fs-uuid ${fs_uuid}"
+    fi
+
     if [ "x$hints" != x ]; then
       echo "if [ x\$feature_platform_search_hint = xy ]; then"
-      echo "  search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
+      echo "  search --no-floppy --set=root ${hints} ${device}"
       echo "else"
-      echo "  search --no-floppy --fs-uuid --set=root ${fs_uuid}"
+      echo "  search --no-floppy --set=root ${device}"
       echo "fi"
     else
-      echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
+      echo "search --no-floppy --set=root ${device}"
     fi
   fi
   IFS="$old_ifs"
util/grub.d/10_linux.in +2 -0
index cc393be7e..d29a004e3 100644
@@ -61,6 +61,9 @@ if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [
 "x${GRUB_DEVICE_PARTUUID}" = "x" ] )
 elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
     || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
   LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
+elif [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
+    && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s
Quoted 10 lines

LABEL -o value)" ]; then
+ LINUX_ROOT_DEVICE=LABEL="$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)"
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
--
2.30.2

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#3 lore raw

Re: [PATCH 1/2] Allow specifying the boot device by its label instead of UUID

That's what I'd like to do, but I couldn't figure out how to make 'git format-patch -2' output a single patch. It always outputs one patch per commit.

Is there an option I've missed, or is there no other way than creating a throwaway repo to squash the commits before sending?

Quoted 71 lines · Vladimir 'phcoder' Serbinenko

Please don't segment patches like this showing 2 solutions. Just have the patch for the agreed solution

Le mer. 27 sept. 2023, 13:14, darkpenguin <[email protected] <mailto:[email protected]>> a écrit :

    ---
     util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in> | 14
    +++++++++++---
     util/grub.d/10_linux.in <http://10_linux.in>   |  3 +++
     2 files changed, 14 insertions(+), 3 deletions(-)

    diff --git a/util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in>
    b/util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in>
    index 08953287c..bd43bc01d 100644
    --- a/util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in>
    +++ b/util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in>
    @@ -158,14 +158,22 @@ prepare_grub_to_access_device ()
       fi
       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=
    +
    +    if [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
    +        && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${fs_uuid}
    -s LABEL -o value)" ]; then
    +      device="--label $(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)"
    +    else
    +      device="--fs-uuid ${fs_uuid}"
    +    fi
    +
         if [ "x$hints" != x ]; then
           echo "if [ x\$feature_platform_search_hint = xy ]; then"
    -      echo "  search --no-floppy --fs-uuid --set=root ${hints}
    ${fs_uuid}"
    +      echo "  search --no-floppy --set=root ${hints} ${device}"
           echo "else"
    -      echo "  search --no-floppy --fs-uuid --set=root ${fs_uuid}"
    +      echo "  search --no-floppy --set=root ${device}"
           echo "fi"
         else
    -      echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
    +      echo "search --no-floppy --set=root ${device}"
         fi
       fi
       IFS="$old_ifs"
    diff --git a/util/grub.d/10_linux.in <http://10_linux.in>
    b/util/grub.d/10_linux.in <http://10_linux.in>
    index cc393be7e..d29a004e3 100644
    --- a/util/grub.d/10_linux.in <http://10_linux.in>
    +++ b/util/grub.d/10_linux.in <http://10_linux.in>
    @@ -61,6 +61,9 @@ if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [
    "x${GRUB_DEVICE_PARTUUID}" = "x" ] )
     elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
         || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
       LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
    +elif [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
    +    && [ -b "/dev/disk/by-label/$(blkid -l -t
    UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)" ]; then
    +  LINUX_ROOT_DEVICE=LABEL="$(blkid -l -t UUID=${GRUB_DEVICE_UUID}
    -s LABEL -o value)"
     else
       LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
     fi
    -- 
    2.30.2
Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#4 lore raw

Re: [PATCH 1/2] Allow specifying the boot device by its label instead of UUID

Quoted 6 lines · darkpenguin

That's what I'd like to do, but I couldn't figure out how to make 'git format-patch -2' output a single patch. It always outputs one patch per commit.

Is there an option I've missed, or is there no other way than creating a throwaway repo to squash the commits before sending?

Try

git rebase -i HEAD~2

Mark the second commit as fixup or squash.

Best regards

Heinrich

Quoted 80 lines · Vladimir 'phcoder' Serbinenko
Quoted 71 lines

Please don't segment patches like this showing 2 solutions. Just have the patch for the agreed solution

Le mer. 27 sept. 2023, 13:14, darkpenguin <[email protected] <mailto:[email protected]>> a écrit :

     ---
      util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in> | 14
     +++++++++++---
      util/grub.d/10_linux.in <http://10_linux.in>   |  3 +++
      2 files changed, 14 insertions(+), 3 deletions(-)

     diff --git a/util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in>
     b/util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in>
     index 08953287c..bd43bc01d 100644
     --- a/util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in>
     +++ b/util/grub-mkconfig_lib.in <http://grub-mkconfig_lib.in>
     @@ -158,14 +158,22 @@ prepare_grub_to_access_device ()
        fi
        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=
     +
     +    if [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
     +        && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${fs_uuid}
     -s LABEL -o value)" ]; then
     +      device="--label $(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)"
     +    else
     +      device="--fs-uuid ${fs_uuid}"
     +    fi
     +
          if [ "x$hints" != x ]; then
            echo "if [ x\$feature_platform_search_hint = xy ]; then"
     -      echo "  search --no-floppy --fs-uuid --set=root ${hints}
     ${fs_uuid}"
     +      echo "  search --no-floppy --set=root ${hints} ${device}"
            echo "else"
     -      echo "  search --no-floppy --fs-uuid --set=root ${fs_uuid}"
     +      echo "  search --no-floppy --set=root ${device}"
            echo "fi"
          else
     -      echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
     +      echo "search --no-floppy --set=root ${device}"
          fi
        fi
        IFS="$old_ifs"
     diff --git a/util/grub.d/10_linux.in <http://10_linux.in>
     b/util/grub.d/10_linux.in <http://10_linux.in>
     index cc393be7e..d29a004e3 100644
     --- a/util/grub.d/10_linux.in <http://10_linux.in>
     +++ b/util/grub.d/10_linux.in <http://10_linux.in>
     @@ -61,6 +61,9 @@ if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [
     "x${GRUB_DEVICE_PARTUUID}" = "x" ] )
      elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
          || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
        LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
     +elif [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
     +    && [ -b "/dev/disk/by-label/$(blkid -l -t
     UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)" ]; then
     +  LINUX_ROOT_DEVICE=LABEL="$(blkid -l -t UUID=${GRUB_DEVICE_UUID}
     -s LABEL -o value)"
      else
        LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
      fi
     --
     2.30.2
Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Quoted 4 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#5 lore raw

PATCH 1/1 Allow specifying the boot device by its label instead of UUID

Here it is, as a single patch, and in reply to the corresponding thread this time!

---
 util/grub-mkconfig.in     |  1 +
 util/grub-mkconfig_lib.in | 14 +++++++++++---
 util/grub.d/10_linux.in   |  3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)
util/grub-mkconfig.in +1 -0
index 32c480dae..fb5000d3f 100644
@@ -244,6 +244,7 @@ export GRUB_DEFAULT \
   GRUB_DISABLE_UUID \
   GRUB_DISABLE_LINUX_UUID \
   GRUB_DISABLE_LINUX_PARTUUID \
+  GRUB_ENABLE_LINUX_LABEL \
   GRUB_DISABLE_RECOVERY \
   GRUB_VIDEO_BACKEND \
   GRUB_GFXMODE \
util/grub-mkconfig_lib.in +11 -3
index 08953287c..dd726c4b3 100644
@@ -158,14 +158,22 @@ prepare_grub_to_access_device ()
   fi
   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=
+
+    if [ "x${GRUB_ENABLE_LINUX_LABEL}" = "xtrue" ] \
+        && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)" ]; then
+      device="--label $(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)"
+    else
+      device="--fs-uuid ${fs_uuid}"
+    fi
+
     if [ "x$hints" != x ]; then
       echo "if [ x\$feature_platform_search_hint = xy ]; then"
-      echo "  search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
+      echo "  search --no-floppy --set=root ${hints} ${device}"
       echo "else"
-      echo "  search --no-floppy --fs-uuid --set=root ${fs_uuid}"
+      echo "  search --no-floppy --set=root ${device}"
       echo "fi"
     else
-      echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
+      echo "search --no-floppy --set=root ${device}"
     fi
   fi
   IFS="$old_ifs"
util/grub.d/10_linux.in +3 -0
index cc393be7e..04b973fe7 100644
@@ -61,6 +61,9 @@ if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] )
 elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
     || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
   LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
+elif [ "x${GRUB_ENABLE_LINUX_LABEL}" = "xtrue" ] \
+    && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)" ]; then
+  LINUX_ROOT_DEVICE=LABEL="$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)"
 else
   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
 fi
Signature · 7 lines
2.30.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#6 lore raw

Re: [PATCH] Allow specifying the boot device by its label instead of UUID

Quoted 34 lines · darkpenguin

Here it is, as a single patch, and in reply to the corresponding thread this time!

---
 util/grub-mkconfig.in     |  1 +
 util/grub-mkconfig_lib.in | 14 +++++++++++---
 util/grub.d/10_linux.in   |  3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)
util/grub-mkconfig.in +1 -0
index 32c480dae..fb5000d3f 100644
@@ -244,6 +244,7 @@ export GRUB_DEFAULT \
   GRUB_DISABLE_UUID \
   GRUB_DISABLE_LINUX_UUID \
   GRUB_DISABLE_LINUX_PARTUUID \
+  GRUB_ENABLE_LINUX_LABEL \
   GRUB_DISABLE_RECOVERY \
   GRUB_VIDEO_BACKEND \
   GRUB_GFXMODE \
util/grub-mkconfig_lib.in +0 -1
index 08953287c..dd726c4b3 100644
@@ -158,14 +158,22 @@ prepare_grub_to_access_device ()
   fi
   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=

util/grub-mkconfig_lib.in +3 -0
+
+    if [ "x${GRUB_ENABLE_LINUX_LABEL}" = "xtrue" ] \
+        && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${fs_uuid} -s
Quoted 3 lines

LABEL -o value)" ]; then
+ device="--label $(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)"

When you're outputting labels please avoid using UUIDs for anything. One use case for labels is when for some reason you have 2 filesystems with the same UUID but different labels. Granted this is a rare use case but if we go label route at all we can cover it as well. You already have the name of the device node, so you can just use it.

Quoted 3 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#7 lore raw

Re: [PATCH] Allow specifying the boot device by its label instead of UUID

In reply to darkpenguin

I know you're just learning, so here's some more tips:

Updated patches are generally sent as a "vN" where N is the revision of the series. git format-patch can do this nicely with the -v arg. This would make the subject line look like "[PATCH vN] Allow specifying the boot device by its label instead of UUID".

Updated patches are also typically sent as a new thread instead of as a reply to the old one. Makes for easier review.

Quoted 2 lines · darkpenguin

Here it is, as a single patch, and in reply to the corresponding thread this time!

The way git handles patches, applying this would make the above sentence the commit message. Which is probably not what you were after.

Quoted 11 lines
---
 util/grub-mkconfig.in     |  1 +
 util/grub-mkconfig_lib.in | 14 +++++++++++---
 util/grub.d/10_linux.in   |  3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)
util/grub-mkconfig.in +0 -0
index 32c480dae..fb5000d3f 100644

util/grub-mkconfig.in export GRUB_DEFAULT \ · line 247

Quoted 4 lines
util/grub-mkconfig.in +1 -0
@@ -244,6 +244,7 @@ export GRUB_DEFAULT \
   GRUB_DISABLE_UUID \
   GRUB_DISABLE_LINUX_UUID \
   GRUB_DISABLE_LINUX_PARTUUID \
+  GRUB_ENABLE_LINUX_LABEL \

I still think this should be GRUB_DISABLE_LINUX_LABEL to match the other vars.

util/grub-mkconfig.in export GRUB_DEFAULT \ · line 250

Quoted 3 lines
util/grub-mkconfig.in +0 -0
   GRUB_DISABLE_RECOVERY \
   GRUB_VIDEO_BACKEND \
   GRUB_GFXMODE \

- Oskari

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#8 lore raw

Re: [PATCH] Allow specifying the boot device by its label instead of UUID

Quoted 9 lines · Oskari Pirhonen

I know you're just learning, so here's some more tips:

Updated patches are generally sent as a "vN" where N is the revision of the series. git format-patch can do this nicely with the -v arg. This would make the subject line look like "[PATCH vN] Allow specifying the boot device by its label instead of UUID".

Updated patches are also typically sent as a new thread instead of as a reply to the old one. Makes for easier review.

Yes! Thanks! It's not easy to figure out the proper procedure and conventions because they are not in the manuals. :)

Quoted 13 lines · darkpenguin
Quoted 2 lines

Here it is, as a single patch, and in reply to the corresponding thread this time!

The way git handles patches, applying this would make the above sentence the commit message. Which is probably not what you were after.

Quoted 6 lines
---
 util/grub-mkconfig.in     |  1 +
 util/grub-mkconfig_lib.in | 14 +++++++++++---
 util/grub.d/10_linux.in   |  3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)
Quoted 12 lines

util/grub-mkconfig.in export GRUB_DEFAULT \ · line 247

Quoted 9 lines
util/grub-mkconfig.in +1 -0
index 32c480dae..fb5000d3f 100644
@@ -244,6 +244,7 @@ export GRUB_DEFAULT \
   GRUB_DISABLE_UUID \
   GRUB_DISABLE_LINUX_UUID \
   GRUB_DISABLE_LINUX_PARTUUID \
+  GRUB_ENABLE_LINUX_LABEL \

I still think this should be GRUB_DISABLE_LINUX_LABEL to match the other vars.

I don't mind, so let's do it that way then; I've found a mention of GRUB_ENABLE_LINUX_LABEL on the Internet, and I thought that maybe it was used before - so let's keep compatibility. But I think the user who posted it was mistaken, so either way it fine.

Now that we know that GRUB has nothing to do with fstab, we can just use GRUB_DISABLE_LINUX_LABEL.

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#9 lore raw

PATCH 2/2 Use GRUB_ENABLE_LINUX_LABEL=true instead of GRUB_DISABLE_LINUX_UUID=LABEL

In reply to darkpenguin
---
 util/grub-mkconfig.in     | 1 +
 util/grub-mkconfig_lib.in | 2 +-
 util/grub.d/10_linux.in   | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
util/grub-mkconfig.in +1 -0
index 32c480dae..fb5000d3f 100644
@@ -244,6 +244,7 @@ export GRUB_DEFAULT \
   GRUB_DISABLE_UUID \
   GRUB_DISABLE_LINUX_UUID \
   GRUB_DISABLE_LINUX_PARTUUID \
+  GRUB_ENABLE_LINUX_LABEL \
   GRUB_DISABLE_RECOVERY \
   GRUB_VIDEO_BACKEND \
   GRUB_GFXMODE \
util/grub-mkconfig_lib.in +1 -1
index bd43bc01d..dd726c4b3 100644
@@ -159,7 +159,7 @@ prepare_grub_to_access_device ()
   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=
 
-    if [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
+    if [ "x${GRUB_ENABLE_LINUX_LABEL}" = "xtrue" ] \
         && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)" ]; then
       device="--label $(blkid -l -t UUID=${fs_uuid} -s LABEL -o value)"
     else
util/grub.d/10_linux.in +1 -1
index d29a004e3..04b973fe7 100644
@@ -61,7 +61,7 @@ if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] )
 elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
     || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
   LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
-elif [ "x${GRUB_DISABLE_LINUX_UUID}" = "xLABEL" ] \
+elif [ "x${GRUB_ENABLE_LINUX_LABEL}" = "xtrue" ] \
     && [ -b "/dev/disk/by-label/$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)" ]; then
   LINUX_ROOT_DEVICE=LABEL="$(blkid -l -t UUID=${GRUB_DEVICE_UUID} -s LABEL -o value)"
 else
Signature · 7 lines
2.30.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel