All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add support for specifying the boot device by label
@ 2023-09-27 11:13 darkpenguin
  2023-09-27 11:13 ` [PATCH 1/2] Allow specifying the boot device by its label instead of UUID darkpenguin
  2023-09-27 11:13 ` [PATCH 2/2] Use GRUB_ENABLE_LINUX_LABEL=true instead of GRUB_DISABLE_LINUX_UUID=LABEL darkpenguin
  0 siblings, 2 replies; 10+ messages in thread
From: darkpenguin @ 2023-09-27 11:13 UTC (permalink / raw)
  To: grub-devel; +Cc: xxc3ncoredxx, phcoder, nvinson234, dkiper, darkpenguin


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(-)

-- 
2.30.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] Allow specifying the boot device by its label instead of UUID
  2023-09-27 11:13 [PATCH 0/2] Add support for specifying the boot device by label darkpenguin
@ 2023-09-27 11:13 ` darkpenguin
  2023-09-27 15:50   ` Vladimir 'phcoder' Serbinenko
  2023-09-27 11:13 ` [PATCH 2/2] Use GRUB_ENABLE_LINUX_LABEL=true instead of GRUB_DISABLE_LINUX_UUID=LABEL darkpenguin
  1 sibling, 1 reply; 10+ messages in thread
From: darkpenguin @ 2023-09-27 11:13 UTC (permalink / raw)
  To: grub-devel; +Cc: xxc3ncoredxx, phcoder, nvinson234, dkiper, darkpenguin

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

diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 08953287c..bd43bc01d 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/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 b/util/grub.d/10_linux.in
index cc393be7e..d29a004e3 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/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


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] Use GRUB_ENABLE_LINUX_LABEL=true instead of GRUB_DISABLE_LINUX_UUID=LABEL
  2023-09-27 11:13 [PATCH 0/2] Add support for specifying the boot device by label darkpenguin
  2023-09-27 11:13 ` [PATCH 1/2] Allow specifying the boot device by its label instead of UUID darkpenguin
@ 2023-09-27 11:13 ` darkpenguin
  1 sibling, 0 replies; 10+ messages in thread
From: darkpenguin @ 2023-09-27 11:13 UTC (permalink / raw)
  To: grub-devel; +Cc: xxc3ncoredxx, phcoder, nvinson234, dkiper, 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(-)

diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 32c480dae..fb5000d3f 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -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 \
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index bd43bc01d..dd726c4b3 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -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
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index d29a004e3..04b973fe7 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -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
-- 
2.30.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] Allow specifying the boot device by its label instead of UUID
  2023-09-27 11:13 ` [PATCH 1/2] Allow specifying the boot device by its label instead of UUID darkpenguin
@ 2023-09-27 15:50   ` Vladimir 'phcoder' Serbinenko
  2023-09-27 16:02     ` darkpenguin
  0 siblings, 1 reply; 10+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2023-09-27 15:50 UTC (permalink / raw)
  To: darkpenguin
  Cc: The development of GRUB 2, xxc3ncoredxx, nvinson234, Daniel Kiper


[-- Attachment #1.1: Type: text/plain, Size: 2496 bytes --]

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 <darkpenguin@posteo.de> a écrit :

> ---
>  util/grub-mkconfig_lib.in | 14 +++++++++++---
>  util/grub.d/10_linux.in   |  3 +++
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
> index 08953287c..bd43bc01d 100644
> --- a/util/grub-mkconfig_lib.in
> +++ b/util/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 b/util/grub.d/10_linux.in
> index cc393be7e..d29a004e3 100644
> --- a/util/grub.d/10_linux.in
> +++ b/util/grub.d/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
>
>

[-- Attachment #1.2: Type: text/html, Size: 4129 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] Allow specifying the boot device by its label instead of UUID
  2023-09-27 15:50   ` Vladimir 'phcoder' Serbinenko
@ 2023-09-27 16:02     ` darkpenguin
  2023-09-27 16:18       ` Heinrich Schuchardt
  0 siblings, 1 reply; 10+ messages in thread
From: darkpenguin @ 2023-09-27 16:02 UTC (permalink / raw)
  To: grub-devel

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?


On 27/09/23 19:50, Vladimir 'phcoder' Serbinenko wrote:
> 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 <darkpenguin@posteo.de
> <mailto:darkpenguin@posteo.de>> 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
> 
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] Allow specifying the boot device by its label instead of UUID
  2023-09-27 16:02     ` darkpenguin
@ 2023-09-27 16:18       ` Heinrich Schuchardt
  2023-09-27 16:25         ` [PATCH] " darkpenguin
  0 siblings, 1 reply; 10+ messages in thread
From: Heinrich Schuchardt @ 2023-09-27 16:18 UTC (permalink / raw)
  To: darkpenguin; +Cc: The development of GNU GRUB

On 9/27/23 18:02, darkpenguin wrote:
> 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

>
>
> On 27/09/23 19:50, Vladimir 'phcoder' Serbinenko wrote:
>> 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 <darkpenguin@posteo.de
>> <mailto:darkpenguin@posteo.de>> 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
>>
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] Allow specifying the boot device by its label instead of UUID
  2023-09-27 16:18       ` Heinrich Schuchardt
@ 2023-09-27 16:25         ` darkpenguin
  2023-09-27 20:41           ` Vladimir 'phcoder' Serbinenko
  2023-09-28  5:16           ` Oskari Pirhonen
  0 siblings, 2 replies; 10+ messages in thread
From: darkpenguin @ 2023-09-27 16:25 UTC (permalink / raw)
  To: grub-devel; +Cc: 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(-)

diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 32c480dae..fb5000d3f 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -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 \
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 08953287c..dd726c4b3 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/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_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"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index cc393be7e..04b973fe7 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/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_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
-- 
2.30.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Allow specifying the boot device by its label instead of UUID
  2023-09-27 16:25         ` [PATCH] " darkpenguin
@ 2023-09-27 20:41           ` Vladimir 'phcoder' Serbinenko
  2023-09-28  5:16           ` Oskari Pirhonen
  1 sibling, 0 replies; 10+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2023-09-27 20:41 UTC (permalink / raw)
  To: The development of GNU GRUB


[-- Attachment #1.1: Type: text/plain, Size: 1840 bytes --]

Le mer. 27 sept. 2023, 18:26, darkpenguin <darkpenguin@posteo.de> a écrit :

> 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(-)
>
> diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
> index 32c480dae..fb5000d3f 100644
> --- a/util/grub-mkconfig.in
> +++ b/util/grub-mkconfig.in
> @@ -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 \
> diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
> index 08953287c..dd726c4b3 100644
> --- a/util/grub-mkconfig_lib.in
> +++ b/util/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_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)"
>

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.

>

>

[-- Attachment #1.2: Type: text/html, Size: 3649 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Allow specifying the boot device by its label instead of UUID
  2023-09-27 16:25         ` [PATCH] " darkpenguin
  2023-09-27 20:41           ` Vladimir 'phcoder' Serbinenko
@ 2023-09-28  5:16           ` Oskari Pirhonen
  2023-09-28  8:05             ` darkpenguin
  1 sibling, 1 reply; 10+ messages in thread
From: Oskari Pirhonen @ 2023-09-28  5:16 UTC (permalink / raw)
  To: darkpenguin; +Cc: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 1437 bytes --]

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.

On Wed, Sep 27, 2023 at 16:25:23 +0000, darkpenguin wrote:
> 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.

> ---
>  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(-)
> 
> diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
> index 32c480dae..fb5000d3f 100644
> --- a/util/grub-mkconfig.in
> +++ b/util/grub-mkconfig.in
> @@ -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.

>    GRUB_DISABLE_RECOVERY \
>    GRUB_VIDEO_BACKEND \
>    GRUB_GFXMODE \

- Oskari

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Allow specifying the boot device by its label instead of UUID
  2023-09-28  5:16           ` Oskari Pirhonen
@ 2023-09-28  8:05             ` darkpenguin
  0 siblings, 0 replies; 10+ messages in thread
From: darkpenguin @ 2023-09-28  8:05 UTC (permalink / raw)
  To: grub-devel

On 28/09/23 09:16, Oskari Pirhonen wrote:
> 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. :)


> On Wed, Sep 27, 2023 at 16:25:23 +0000, darkpenguin wrote:
>> 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.
> 
>> ---
>>  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(-)
>>
>> diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
>> index 32c480dae..fb5000d3f 100644
>> --- a/util/grub-mkconfig.in
>> +++ b/util/grub-mkconfig.in
>> @@ -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
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-09-28  8:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 11:13 [PATCH 0/2] Add support for specifying the boot device by label darkpenguin
2023-09-27 11:13 ` [PATCH 1/2] Allow specifying the boot device by its label instead of UUID darkpenguin
2023-09-27 15:50   ` Vladimir 'phcoder' Serbinenko
2023-09-27 16:02     ` darkpenguin
2023-09-27 16:18       ` Heinrich Schuchardt
2023-09-27 16:25         ` [PATCH] " darkpenguin
2023-09-27 20:41           ` Vladimir 'phcoder' Serbinenko
2023-09-28  5:16           ` Oskari Pirhonen
2023-09-28  8:05             ` darkpenguin
2023-09-27 11:13 ` [PATCH 2/2] Use GRUB_ENABLE_LINUX_LABEL=true instead of GRUB_DISABLE_LINUX_UUID=LABEL darkpenguin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.