stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
namespace StellaOps.DistroIntel;
|
||||
|
||||
public static partial class DistroMappings
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if a distro is a known canonical (parent) distro.
|
||||
/// </summary>
|
||||
/// <param name="distro">The distro identifier to check.</param>
|
||||
/// <returns>True if the distro is a known canonical distro.</returns>
|
||||
public static bool IsCanonicalDistro(string distro)
|
||||
{
|
||||
var lower = distro.ToLowerInvariant();
|
||||
return lower is "rhel" or "debian" or "ubuntu" or "sles" or "alpine";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalizes a distro name to its canonical form.
|
||||
/// </summary>
|
||||
/// <param name="distro">The distro name to normalize.</param>
|
||||
/// <returns>Lowercase canonical form.</returns>
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user