From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1PE5TM-00070F-Ti for mharc-grub-devel@gnu.org; Thu, 04 Nov 2010 15:27:44 -0400 Received: from [140.186.70.92] (port=37036 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PE5T6-0006Vx-DA for grub-devel@gnu.org; Thu, 04 Nov 2010 15:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PE5So-0005cE-L6 for grub-devel@gnu.org; Thu, 04 Nov 2010 15:27:13 -0400 Received: from smarthost01.mail.zen.net.uk ([212.23.3.140]:48366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PE5So-0005bm-Dy for grub-devel@gnu.org; Thu, 04 Nov 2010 15:27:10 -0400 Received: from [82.69.3.149] (helo=[192.168.1.65]) by smarthost01.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1PE5Sl-0004mU-MK for grub-devel@gnu.org; Thu, 04 Nov 2010 19:27:07 +0000 Message-ID: <4CD3090B.3000004@zen.co.uk> Date: Thu, 04 Nov 2010 19:27:07 +0000 From: Barry Jackson User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-UK; rv:1.9.2.13pre) Gecko/20101104 Lightning/1.0b2 Lanikai/3.1.7pre MIME-Version: 1.0 To: grub-devel@gnu.org References: <4CD0A554.5060404@zen.co.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Originating-Smarthost01-IP: [82.69.3.149] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: Labels in grub2 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2010 19:27:43 -0000 On 04/11/10 12:12, Andrey Borzenkov wrote: > On Wed, Nov 3, 2010 at 2:57 AM, Barry Jackson 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 >