grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Labels in grub2


From: Andrey Borzenkov
Subject: Re: Labels in grub2
Date: Thu, 4 Nov 2010 15:12:08 +0300

On Wed, Nov 3, 2010 at 2:57 AM, Barry Jackson <address@hidden> wrote:
>
> In the meantime I have made some patches to demonstrate this idea in grub
> 1.98 which I have attached.
>

gmail does not make it easy to quote patches :(

> --- /usr/sbin/grub2-mkconfig  2010-11-02 22:38:20.610505816 +0000
> +++ grub2-mkconfig    2010-11-02 22:35:32.000000000 +0000
> +GRUB_DEVICE_LABEL=$(blkid ${GRUB_DEVICE}| grep "LABEL=" |tr -s 'LABEL=' '*' 
> | cut -d* -f2 | cut -d'"' -f2)

This is very elaborate way to implement

GRUB_DEVICE_LABEL="$(blkid -s LABEL -o value ${GRUB_DEVICE})"

:)

And you have to check whether blkid exists ...

> @@ -226,6 +233,8 @@
>   GRUB_INIT_TUNE \
>   GRUB_SAVEDEFAULT
>
> +
> +
>  if test "x${grub_cfg}" != "x"; then

You probably should not introduce unrelated formatting changes.

> --- /etc/grub.d/10_linux      2010-11-02 22:25:19.849508548 +0000
> +++ 10_linux  2010-11-02 22:05:31.000000000 +0000
> @@ -42,11 +42,17 @@
> +# If A label exists and GRUB_USE_LABEL=true is in /etc/default/grub  (bcj)
> +   if [ "x${GRUB_DEVICE_LABEL}" != "x" ] && [ "x${GRUB_USE_LABEL}" = "xtrue" 
> ]; then
> +      LINUX_ROOT_DEVICE=LABEL=${GRUB_DEVICE_LABEL}

Label may contain spaces as opposed to UUID, I think. Although I guess
in real life label with spaces will cause much more problem elsewhere.
 Same in grub-mkconfig_lib patch BTW

> They work fine for me, with GRUB_USE_LABEL="true" set in /etc/default/grub
> in my Mandriva-Linux systems.
>
> A grub.cfg produced with a patched grub2 is attached also.
>
> I am not a professional programmer, so I would appreciate any constructive
> criticism, and your comments in general on this idea.

I think it is fine as option as long as it is not default. Labels have
much more chances to duplicate than UUIDs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]