Hi
I'm trying to make a variable stick around in the general grub environment after defining it in an embedded grub.cfg file. E.g., a grub.cfg file baked into core.img like this: : set important_env_var="1" : export important_env_var does seem to define the variable correctly until grub loads the "actual" config file from the boot partition (otherwise it wouldn't have been able to read that file in the first place), but it's not defined in the environment past that point. It doesn't show up in the grub shell and I generally see grub misbehaving like it would if the env variable is unset. Setting and exporting it manually at that point makes things work again. I could naturally define the variable in both places, but that doesn't really make sense. I'm unsure if that's a bug or intended behavior, though. The documentation for "export" says: > Exported variables are visible to subsidiary configuration files loaded using > configfile. which makes me believe that such environment variables should outlive a switch into normal mode; however, "configfile" explicitly states: > Any environment variable changes made by the commands in file will not be > preserved after configfile returns. That's important, because I would assume that "normal" uses "configfile" to load the config file. It sounds like core.img-grub.cfg's scope runs out just before grub calls "normal" and hence any environment changes made there are lost. Is there a way to create persistent environment variables in core.img's grub.cfg? I figure a workaround such as calling "normal" in the embedded grub.cfg might work because it extends the config file's execution and normal mode would run as part of the initial environment, but that's hacky. Mihai
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
