stages(grub2): allow pulling efi binaries from alternative efi roots

The EFI binaries are currently pulled from a hardcoded path in the
buildroot. When moving to containers as buildroots this will no
longer work as they have an alternative layout. This is an easy
"fix" - make the location of the `EFI/` directory configurable.

This allows us set `efi_src_dir` to `/usr/lib/bootupd/updates/EFI/`
and keep our existing `bootc-image-builder` workflow.

Note that this may actually not be the desired solution and instead
we want the new `bootupd`: https://github.com/osbuild/osbuild/pull/1519
This commit is contained in:
Michael Vogt 2024-01-05 12:41:36 +01:00 committed by Achilleas Koutsou
parent cb02d0a4bc
commit c03e6be52a
2 changed files with 41 additions and 3 deletions

32
stages/test/test_grub2.py Normal file
View file

@ -0,0 +1,32 @@
#!/usr/bin/python3
import os.path
from osbuild.testutil import make_fake_tree
from osbuild.testutil.imports import import_module_from_path
def test_grub2_copy_efi_data(tmp_path):
stage_path = os.path.join(os.path.dirname(__file__), "../org.osbuild.grub2")
stage = import_module_from_path("stage", stage_path)
fake_efi_src_dir = tmp_path / "fake-efi/EFI"
make_fake_tree(fake_efi_src_dir, {
"fedora/a.shim": "fake shim",
"BOOT/BOOTX64.EFI": "I'm not real",
})
test_options = {
"rootfs": {
"label": "my-rootfs",
},
"uefi": {
"install": True,
"efi_src_dir": fake_efi_src_dir,
"vendor": "fedora",
},
}
fake_tree = tmp_path / "tree"
stage.main(fake_tree, test_options)
assert (fake_tree / "boot/efi/EFI/fedora/a.shim").exists()
assert (fake_tree / "boot/efi/EFI/BOOT/BOOTX64.EFI").exists()