From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YxSZn-0001iF-Ao for mharc-grub-devel@gnu.org; Wed, 27 May 2015 00:04:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxSZk-0001hp-Bg for grub-devel@gnu.org; Wed, 27 May 2015 00:04:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxSZh-0006Ej-4L for grub-devel@gnu.org; Wed, 27 May 2015 00:04:16 -0400 Received: from mail-la0-x22f.google.com ([2a00:1450:4010:c03::22f]:33665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxSZg-0006EF-Ss for grub-devel@gnu.org; Wed, 27 May 2015 00:04:13 -0400 Received: by lalw1 with SMTP id w1so13384283lal.0 for ; Tue, 26 May 2015 21:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=NS/LAXuGTNhOOqSVzIjWvwqWaFDDDAKh23dpdwrezrQ=; b=ghNN3KkgRfDgGiqvGZcNKdaIf/01R/dJp4p73ooN4/gITAh7/JJevGFSL9DR/veSnY yqxE2U/ioj1KvZf/rzzwunHdLpPJP5vqlDaorv1qLQWKib/sCOMn1nAFFO9/ZNLKeL2V kdEYTT4KSW4Xs5T4OSl7SyJp93Rg68dwVDAA4Oj45cb2eg6WTkYaOtvIToFnrnKxJV1B pO4PAP9q9wDnSS2mtyzSHkmpzdDVTGfFgeX1T6o1Z/oQlBcCYrmv0dTHT6At0Qjy4sFy QwuFz5B7Z7rJAr7Z+xK1qVLiIvrZq7US4jBwF2UUhoP571mGn3trZDkTxnLuiWeFbJGk s1ZQ== X-Received: by 10.112.185.100 with SMTP id fb4mr5814493lbc.79.1432699452142; Tue, 26 May 2015 21:04:12 -0700 (PDT) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id p9sm539004laf.11.2015.05.26.21.04.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 May 2015 21:04:11 -0700 (PDT) Date: Wed, 27 May 2015 07:04:07 +0300 From: Andrei Borzenkov To: Mathieu Trudel-Lapierre Subject: Re: Set a bootdrive environment variable. Message-ID: <20150527070407.05884736@opensuse.site> In-Reply-To: <1432658768-4225-1-git-send-email-mathieu.trudel-lapierre@canonical.com> References: <1432658768-4225-1-git-send-email-mathieu.trudel-lapierre@canonical.com> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.27; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22f Cc: grub-devel@gnu.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 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: Wed, 27 May 2015 04:04:17 -0000 =D0=92 Tue, 26 May 2015 12:46:07 -0400 Mathieu Trudel-Lapierre =D0=BF=D0=B8=D1=88=D0=B5=D1= =82: > I've been playing with fixing Ubuntu bug 1097570; trying to debug a scrip= t we > use for the EFI images which detects where to boot from based on the loca= tion > of a .disk/info file. >=20 > Turns out this mostly works, except for the fact that grub appears to alw= ays > list devices in a specific order, which interferes with the detection if = more > than one device contains that file. >=20 > I think I can make this work appropriately provided we: > - Use hints for search --file; > - Have some value to pass to --hint=3D designating the boot drive. >=20 If you always want to use the same device GRUB was booted from why do you need to search for anything at all? > Included is a patch that adds a "bootdrive" variable alongside cmdpath; w= hich > contains just the drive designation for the boot device, to be used as su= ch: >=20 > search --set=3Droot --hint=3D$bootdrive --file .disk/info >=20 > I'd much appreciate review on that patch :) >=20 You can extract it from $cmdpath using regexp already. In retrospect having separate variables for device and path would be more flexible; but $drive is not appropriate name as it can refer to network as well. Something like $grub_bootdev and $grub_bootpath.