namespace StellaOps.DistroIntel;
public static partial class DistroMappings
{
///
/// Checks if a distro is a known canonical (parent) distro.
///
/// The distro identifier to check.
/// True if the distro is a known canonical distro.
public static bool IsCanonicalDistro(string distro)
{
var lower = distro.ToLowerInvariant();
return lower is "rhel" or "debian" or "ubuntu" or "sles" or "alpine";
}
///
/// Normalizes a distro name to its canonical form.
///
/// The distro name to normalize.
/// Lowercase canonical form.
public static string NormalizeDistroName(string distro)
{
var lower = distro.ToLowerInvariant();
return lower switch
{
"redhat" or "red hat" or "red-hat" => "rhel",
"alma" or "almalinux-os" => "almalinux",
"rockylinux" or "rocky-linux" => "rocky",
"oracle linux" or "oraclelinux" => "oracle",
"opensuse" or "opensuse-tumbleweed" => "opensuse-leap",
"mint" => "linuxmint",
"popos" or "pop_os" => "pop",
_ => lower
};
}
}