👷 utils: add helper function to get default mountpoint for bootloader

This commit is contained in:
Vladislav Nepogodin 2023-12-08 03:10:10 +04:00
parent b8dbc4418b
commit e91e48f811
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9

View File

@ -113,6 +113,18 @@ constexpr inline double convert_unit(const double number, const std::string_view
return number;
}
// Get appropriate default mountpoint for bootloader
constexpr inline auto bootloader_default_mount(std::string_view bootloader, std::string_view bios_mode) noexcept -> std::string_view {
using namespace std::string_view_literals;
if (bootloader == "systemd-boot"sv || bios_mode == "BIOS"sv) {
return "/boot"sv;
} else if (bootloader == "grub"sv || bootloader == "refind"sv) {
return "/boot/efi"sv;
}
return "unknown bootloader"sv;
}
} // namespace utils
#endif // UTILS_HPP