linuxgrub2

Read file contents to variable in grub.cfg file


Q1. Wanted to know how do you read the contents of a file to a variable at boot time in grub.cfg?

Q2. Could that be extended to read an .ini type file where you can read the values for various name entries?

[section] nothisone=whatever thisone=this is what I want to get

TIA!!


Solution

  • In order to do exactly what you are asking for, you would probably need to write your own GRUB module.

    However, you should be able to achieve what you're after either using the configfile command, or with some clever application of the environment block feature.