updated code
This commit is contained in:
parent
595067286b
commit
24b449782e
1 changed files with 13 additions and 39 deletions
52
Program.cs
52
Program.cs
|
@ -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";
|
||||
|
|
Loading…
Add table
Reference in a new issue