From 87575c1daa49f0426bcf06242a1451dd8be5d6db Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Fri, 8 Dec 2023 11:12:02 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20utils:=20add=20helper=20function?= =?UTF-8?q?=20to=20get=20available=20bootloaders=20for=20system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils.hpp b/src/utils.hpp index 0a4b0c8..6ff1415 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -125,6 +125,16 @@ constexpr inline auto bootloader_default_mount(std::string_view bootloader, std: return "unknown bootloader"sv; } +// Get available bootloaders +constexpr inline auto available_bootloaders(std::string_view bios_mode) noexcept -> std::vector { + using namespace std::string_view_literals; + + if (bios_mode == "BIOS"sv) { + return {"grub"sv, "grub + os-prober"sv}; + } + return {"systemd-boot"sv, "refind"sv, "grub"sv}; +} + } // namespace utils #endif // UTILS_HPP