Skip to main content

classify_bootloader

Function classify_bootloader 

Source
fn classify_bootloader(
    efi_loader_info: Result<String, EfiError>,
    bls_entries_dir_present: bool,
    grub_dir_present: bool,
) -> Result<Bootloader>
Expand description

Pure classifier for the bootloader kind, split from I/O for testability.

  • When EFI_LOADER_INFO is present, its content selects between systemd- boot, GRUB Confidential Compute, and generic GRUB (existing behavior).

  • When there are no EFI variables to inspect (SystemNotUEFI / MissingVar), fall back to a filesystem probe: many non-EFI systems still lay down the BLS Type 1 entry layout at /boot/loader/entries/ (Raspberry Pi with direct-kernel boot from Pi firmware, U-Boot with the extlinux/BLS loader, coreboot with a linux payload, various ARM/embedded boards). Treat those as BLS-compatible so storage::new picks the ESP mount as boot_dir rather than /sysroot/boot/. Only fall back to GRUB when neither an EFI system nor a BLS layout is present.

    A BLS entries directory alone is not sufficient evidence, because GRUB with blscfg reads the same directory. So GRUB’s own directory wins when both are present: a legacy-BIOS Fedora/RHEL install has /boot/grub2/ and /boot/loader/entries/, and is unambiguously GRUB. Only a BLS layout with no GRUB directory implies a BLS-native bootloader.

  • Other EFI read errors propagate.