On Mon, 30 Jan 2023 12:58:31 -0500
Mason Loring Bliss <[email protected]> wrote:

> Hi all. I'm trying to figure out how to get a hash of the current
> config file on-screen. So far my best bet appears to involve making a
> menuentry, but I've hit a wall and I'd love advice:
> 
> The environment variable $config_file seems to go away after the
> menus are rendered, but I can capture that:
> 
>     set meow=${config_file}
> 
> And I can even use that to get a hash, from the command line:
> 
>     hashsum --hash md5 $meow
> 
> ...but I'd need the output of that in a variable to get it into a
> menu. The closest I'm getting is this:
> 
>     set meow=${config_file}
>     menuentry "Hash of $meow" "" {
>       load_video
>       hashsum --hash md5 $meow
>       echo "Press any key to continue..."
>       read
>     }
> 
> ...but I'd really love to have that hash substituted so it's
> on-screen as a menu item, rather than having to select an item to get
> the hash computed.
> 
> Are there options I can pursue that'll do this? I don't see a way to
> capture command output to a variable if there's not an explicit --set
> to do it.

I do not believe a way currently exists. It would be fairly easy to add
a "--set" argument as some other commands do. A patch would be welcome
on the grub-devel mailing list.

Glenn

Reply via email to