updated code

This commit is contained in:
WeeXnes 2025-06-26 18:52:37 +02:00
parent 595067286b
commit 24b449782e

View file

@ -98,7 +98,19 @@ class Program
static List<KernelMenuItem> InitializeKernelMenuItems()
{
var installedKernels = GetInstalledKernels();
var availableCachyosKernels = GetAvailableCachyosKernels();
var availableCachyosKernels = new List<string>
{
"linux-cachyos-bmq",
"linux-cachyos-bore",
"linux-cachyos-deckify",
"linux-cachyos-eevdf",
"linux-cachyos-hardened",
"linux-cachyos-lts",
"linux-cachyos-rc",
"linux-cachyos-rt-bore",
"linux-cachyos-server",
"linux-cachyos"
};
var commonArchKernels = new List<string>
{
@ -173,44 +185,6 @@ class Program
return installed;
}
static string[] GetAvailableCachyosKernels()
{
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "pacman",
Arguments = "-Ss linux-cachyos",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
}
};
try
{
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
if (process.ExitCode != 0)
{
return Array.Empty<string>();
}
return output.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries)
.Where(line => !line.StartsWith(" "))
.Select(line => line.Split('/')[1].Split(' ')[0])
.Distinct()
.ToArray();
}
catch (Exception ex)
{
Console.WriteLine($"Error searching for CachyOS kernels: {ex.Message}");
return Array.Empty<string>();
}
}
static bool InstallKernel(string kernelName)
{
string headersPackageName = kernelName + "-headers";