From 78a98b9ebc789d9c9c701af95e65292d768eee59 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 12 Jun 2018 12:18:34 +0200 Subject: 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 Signed-off-by: Samuel Mendoza-Jonas --- test/parser/test-grub2-blscfg-opts-grubenv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/parser/test-grub2-blscfg-opts-grubenv.c') diff --git a/test/parser/test-grub2-blscfg-opts-grubenv.c b/test/parser/test-grub2-blscfg-opts-grubenv.c index 544a5de..2dffd1b 100644 --- a/test/parser/test-grub2-blscfg-opts-grubenv.c +++ b/test/parser/test-grub2-blscfg-opts-grubenv.c @@ -22,7 +22,7 @@ void run_test(struct parser_test *test) "title Fedora (4.15.2-302.fc28.x86_64) 28 (Twenty Eight)\n" "linux /vmlinuz-4.15.2-302.fc28.x86_64\n" "initrd /initramfs-4.15.2-302.fc28.x86_64.img\n" - "options $kernelopts\n"); + "options $kernelopts debug\n"); test_read_conf_embedded(test, "/boot/grub2/grub.cfg"); @@ -32,5 +32,5 @@ void run_test(struct parser_test *test) opt = get_boot_option(ctx, 0); - check_args(opt, "root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root"); + check_args(opt, "root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root debug"); } -- cgit v1.2.1