Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KEV96-0000ok-I8 for mharc-grub-devel@gnu.org; Thu, 03 Jul 2008 16:11:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KEV94-0000nK-A6 for grub-devel@gnu.org; Thu, 03 Jul 2008 16:11:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KEV92-0000lt-SR for grub-devel@gnu.org; Thu, 03 Jul 2008 16:11:10 -0400 Received: from [199.232.76.173] (port=59879 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KEV92-0000lp-Nx for grub-devel@gnu.org; Thu, 03 Jul 2008 16:11:08 -0400 Received: from rv-out-0708.google.com ([209.85.198.250]:57745) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KEV92-00066g-Cg for grub-devel@gnu.org; Thu, 03 Jul 2008 16:11:08 -0400 Received: by rv-out-0708.google.com with SMTP id k29so1102987rvb.6 for ; Thu, 03 Jul 2008 13:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=DPgUejI2Jv1XNWodiiaiHC4lXaztsqTyQyRAOCl1RBw=; b=Feimg8XSZt4CMbzBeyNpMXUoW5ahIsUq7NkPGlW5nvCzdmiXyx7iXgdSwtZ/KgbhnG MdxZvj+RKpiEeNRgTF4ETXG+R9DoQOpkecn4gZvHQ1ae11tGuoLjIZWTsw/ci9AiGXJ9 nIy5bSBkokMsojW1V6N87Q6plDAIYW8P6At10= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=K7QrzycU0AX6TttzXGgthMfKvMhRW3SJMuCC0ATQh3kplF+K6Ex9iqJO/wAbSLgYEh q+StR+YdnRiWC6tXYfnrrxsugCI/WX8MwPmgaEaIX8MLEvIUKbo6TObplUVd7DZ2ww10 1i567LkzdRPuax3Ege3Cq7ZIhmc2+93kGhqK0= Received: by 10.141.87.13 with SMTP id p13mr76729rvl.93.1215115867358; Thu, 03 Jul 2008 13:11:07 -0700 (PDT) Received: by 10.141.66.21 with HTTP; Thu, 3 Jul 2008 13:11:07 -0700 (PDT) Message-ID: Date: Fri, 4 Jul 2008 04:11:07 +0800 From: Bean To: "The development of GRUB 2" In-Reply-To: <1215108580.4585.11.camel@dv> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080614193028.GB840@thorin> <20080615132552.GA17222@thorin> <20080701155427.GA6985@thorin> <877ic27skd.fsf@xs4all.nl> <1215108580.4585.11.camel@dv> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Re: [PATCH] Save/Load environment variable support X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jul 2008 20:11:11 -0000 On Fri, Jul 4, 2008 at 2:09 AM, Pavel Roskin wrote: > On Thu, 2008-07-03 at 20:04 +0200, Marco Gerards wrote: > >> Great! Can you explain how it works? > > Very good question. It's not "discoverable". I could not find way to > figure out that /boot/grub/grubenv is the default without looking at the > code. > > load_env without arguments merely prints "error: file not found" without > telling which file it needs. Help texts are silent about the defaults. > Many commands ignore extra arguments silently. The whole code needs a > serious cleanup with end users in mind. load_env would load /boot/grub/grubenv with no input, you can also overwrite the default with -f parameter. BTW, I think update-grub should create a new grubenv if it doesn't exists, so that user won't see the file not found error. > > We also have too many commands regarding environment. There is even > freebsd_loadenv, which should probably merged with load_env somehow. Or > maybe not. Maybe all native environment files should be handled with > one command, such as "env". freebsd_loadenv is used to load the hint file, which is plain text. It also add the FreeBSD prefix so that they won't conflict with native variables of grub2. > > We also need mechanisms to implement "savedefault" functionality, > perhaps with easy examples. Maybe update-grub should use it. > > Anyway, to start using it, create the environment file: grub-editenv (by > the way, grub-env would be a better name): > > grub-editenv /boot/grub/grubenv create > grub-editenv /boot/grub/grubenv set foo=bar > > Now you can inspect it with "list_env", load it into environment with > "load_env" and save variables into it with "save_env". Yes, this is the basic idea. -- Bean