]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Don't install a boot loader if no kernels are installed
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 12 May 2023 08:40:03 +0000 (10:40 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 12 May 2023 09:09:47 +0000 (11:09 +0200)
If a bootable image has not been explicitly requested, don't install
a boot loader if we can't find any kernel images installed in the image.

mkosi/__init__.py

index 946c6903c0e5085d7cdbd1ca55876d5a879f74b6..d4525185991c627b243878d0ddce7ffdbeaaea82 100644 (file)
@@ -377,6 +377,9 @@ def install_boot_loader(state: MkosiState) -> None:
     if state.config.output_format == OutputFormat.cpio and state.config.bootable == ConfigFeature.auto:
         return
 
+    if not any(gen_kernel_images(state)) and state.config.bootable == ConfigFeature.auto:
+        return
+
     directory = state.root / "usr/lib/systemd/boot/efi"
     if not directory.exists() or not any(directory.iterdir()):
         if state.config.bootable == ConfigFeature.enabled: