[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Save/Load environment variable support
From: |
Bean |
Subject: |
Re: [PATCH] Save/Load environment variable support |
Date: |
Fri, 4 Jul 2008 04:11:07 +0800 |
On Fri, Jul 4, 2008 at 2:09 AM, Pavel Roskin <address@hidden> 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