]> git.ozlabs.org Git - petitboot/commit
discover/grub: Improve BLS grub environment variables expansion
authorJavier Martinez Canillas <javierm@redhat.com>
Tue, 12 Jun 2018 10:18:34 +0000 (12:18 +0200)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 18 Jun 2018 00:56:33 +0000 (10:56 +1000)
commit78a98b9ebc789d9c9c701af95e65292d768eee59
tree9a3664761d2a27c65572053ffb9380071c8cd1d2
parent6d06f0dbe1195cd8be7d3c54d02012ff16466d0c
discover/grub: Improve BLS grub environment variables expansion

The fields from a BootLoaderSpec file can contain environment variables,
in GRUB 2 these are show verbatim and are evaluated later when an entry
is selected. But on Petitboot these have to be expanded before creating
the GRUB 2 resources and show in the UI the values after the evaluation.

The current blscfg handler had a very limited support for variables, it
only had support for the options field and also didn't take into account
that variables could be mixed with literal values.

So for example the following fields were not expanded correctly:

  linux   $bootprefix/vmlinuz

  options $kernelopts foo=bar

  options foo=bar $kernelopts

  options $kernelopts $debugopts

Also change some of the tests to cover mixing variables and literals.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
discover/grub2/blscfg.c
test/parser/test-grub2-blscfg-multiple-bls.c
test/parser/test-grub2-blscfg-opts-grubenv.c