help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading File Name or Contents


From: Joāo Ricardo Sares Teles de Matos
Subject: Re: Reading File Name or Contents
Date: Fri, 17 Jul 2015 22:24:29 +0100
User-agent: K-9 Mail for Android

Note: update-grub may be a distribution-specific script (maybe specific to Debian and derivatives).

Looking at the grub manual, I only see grub-mkconfig.
https://www.gnu.org/software/grub/manual/html_node/Invoking-grub_002dmkconfig.html

I believe the update-grub I mentioned just ends up calling it with a couple preset arguments.

If you're using some other GNU/Linux distribution, try to find out about its mechanism to generate GRUB's configuration.
In Debian, GRUB's configuration is generated by scripts in /etc/grub.d/

On July 17, 2015 10:08:33 PM GMT+01:00, "Joāo Ricardo Sares Teles de Matos" <address@hidden> wrote:
You could use the environment block:
https://www.gnu.org/software/grub/manual/html_node/Environment-block.html

But I believe that kind of logic is supposed to go into the scripts that generate your grub.cfg when you run update-grub, and not into the generated grub.cfg itself.

On July 17, 2015 3:12:36 PM GMT+01:00, Marc Smith <address@hidden> wrote:
Hi,

Looking for any possibility of reading the contents of a file (or even just the file name) into a variable in a GRUB config file? I've read that command substitution is not supported and no plans to add it, but is there any other way?

I've tried a couple other methods without success (in the grub.cfg file):
--snip--
while read ver_str;
do
    something_with ${ver_str}
done < /version_file
--snip--

OR

--snip--
cat /version_file | while read ver_string;
do
    something_with ${ver_str}
done
--snip--

The goal is to read a "version string" from a file at boot with GRUB to display different menu entries for different versions, but I'd even take just getting the string from the file name at this point. Any ideas? My last resort is to just use sed to modify grub.cfg when a new version of the OS is installed (for a new GRUB menu entry), but I'd prefer not to do that unless I have to.

Or what about including another grub.cfg file and then in the included GRUB config file just have the line "set ver_str=0.1.1" -- I was thinking using the 'configfile' command would do this, but doesn't seem to work as I expected.

Any help or ideas would be greatly appreciated.


Thanks,

Marc



Help-grub mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-grub


--
Typed with a virtual keyboard. Please excuse any blunders.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]