All of lore.kernel.org
 help / color / mirror / Atom feed
From: Barry Jackson <zen25000@zen.co.uk>
To: grub-devel@gnu.org
Subject: Re: Labels in grub2
Date: Thu, 04 Nov 2010 19:27:07 +0000	[thread overview]
Message-ID: <4CD3090B.3000004@zen.co.uk> (raw)
In-Reply-To: <AANLkTikuzD6=+y0rcidW+E93Gk-rMRhEvkWGiFc1fH9f@mail.gmail.com>

On 04/11/10 12:12, Andrey Borzenkov wrote:
> On Wed, Nov 3, 2010 at 2:57 AM, Barry Jackson<zen25000@zen.co.uk>  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})"
>
> :)
>
Neat thanks, I forgot that the latest blkid has that feature :-(
In the latest beta grub, grub-probe can be used instead of blkid for this.

> And you have to check whether blkid exists ...

Yes. I suppose it's possible that it may not be available. I was only 
thinking of Mandriva.

>
>> @@ -226,6 +233,8 @@
>>    GRUB_INIT_TUNE \
>>    GRUB_SAVEDEFAULT
>>
>> +
>> +
>>   if test "x${grub_cfg}" != "x"; then
>
> You probably should not introduce unrelated formatting changes.

I don't understand what you mean by that. Ah - those blank lines?
OK, yes, that was accidental. Must be more careful.

>
>> --- /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
>
Yes labels can have spaces, but it's a bad idea and yes things do break, 
maybe LINUX_ROOT_DEVICE=LABEL="${GRUB_DEVICE_LABEL}" would be enough. Or 
maybe detect labels with spaces and exit 1 would be safer.
I will do more testing.

>> 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
I agree

> Labels have
> much more chances to duplicate than UUIDs.
>
If users can't think of unique labels then it's time to give up :-(

I really hope that the grub developers pick up this idea and run with it.

Thanks for your input.

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



      reply	other threads:[~2010-11-04 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02 23:57 Labels in grub2 Barry Jackson
2010-11-04 10:40 ` Frombenny
2010-11-04 12:12 ` Andrey Borzenkov
2010-11-04 19:27   ` Barry Jackson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CD3090B.3000004@zen.co.uk \
    --to=zen25000@zen.co.uk \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.