scx package check

This commit is contained in:
Ward from fusion-voyager-3 2024-06-22 21:15:37 +03:00
parent 9cd9f6dd8f
commit b0dca62811
10 changed files with 36 additions and 14 deletions

BIN
core

Binary file not shown.

View File

@ -13,6 +13,12 @@
"packages": "kernel-cachyos kernel-cachyos-devel-matched", "packages": "kernel-cachyos kernel-cachyos-devel-matched",
"min_x86_march": "2" "min_x86_march": "2"
}, },
{
"name": "Sched EXT SCX",
"main_package": "sched-ext-scx",
"packages": "sched-ext-scx",
"min_x86_march": "1"
},
{ {
"name": "UKSMD Daemon", "name": "UKSMD Daemon",
"main_package": "uksmd", "main_package": "uksmd",

View File

@ -8,6 +8,7 @@
"browse_kernels_button_tooltip_text": "Browse Kernel for select branch", "browse_kernels_button_tooltip_text": "Browse Kernel for select branch",
"config_kernel_button_tooltip_text": "Configure Sched_EXT settings", "config_kernel_button_tooltip_text": "Configure Sched_EXT settings",
"config_kernel_button_tooltip_text_no_scx": "Currently running kernel doesn't support Sched-EXT", "config_kernel_button_tooltip_text_no_scx": "Currently running kernel doesn't support Sched-EXT",
"config_kernel_button_tooltip_text_no_scx_installed": "Your kernel supports Sched-EXT but the sched-ext-scx packages is not installed!\nInstall it, reboot, try again",
"null_checkbutton_label": "No branch selected", "null_checkbutton_label": "No branch selected",
"db_load_complete": "DB load complete!", "db_load_complete": "DB load complete!",
"db_downloading": "Downloading & Parsing package DB for", "db_downloading": "Downloading & Parsing package DB for",

View File

@ -4,7 +4,7 @@
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"> "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
<policyconfig> <policyconfig>
<action id="fdm.change.scx"> <action id="fkm.change.scx">
<message>Authentication is required to change the SCX Scheduler</message> <message>Authentication is required to change the SCX Scheduler</message>
<icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name> <icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name>
<defaults> <defaults>

View File

@ -4,7 +4,7 @@
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"> "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
<policyconfig> <policyconfig>
<action id="fdm.kernel.cachyos.init"> <action id="fkm.kernel.cachyos.init">
<message>Authentication is required to initialize the Cachyos kernel repo</message> <message>Authentication is required to initialize the Cachyos kernel repo</message>
<icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name> <icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name>
<defaults> <defaults>

View File

@ -4,7 +4,7 @@
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"> "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
<policyconfig> <policyconfig>
<action id="fdm.modify.package"> <action id="fkm.modify.package">
<message>Authentication is required to modify system packages</message> <message>Authentication is required to modify system packages</message>
<icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name> <icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name>
<defaults> <defaults>

View File

@ -1,6 +0,0 @@
/* Allow passwordless auth for fdm.kernel.cachyos.init
polkit.addRule(function(action, subject) {
if (action.id == "fdm.kernel.cachyos.init" {
return polkit.Result.YES;
}
});

View File

@ -0,0 +1,6 @@
/* Allow passwordless auth for fkm.kernel.cachyos.init
polkit.addRule(function(action, subject) {
if (action.id == "fkm.kernel.cachyos.init" {
return polkit.Result.YES;
}
});

View File

@ -30,6 +30,8 @@ Requires: polkit
Requires: iputils Requires: iputils
Requires: fedora-kernel-manager-cachyos-config Requires: fedora-kernel-manager-cachyos-config
Recommends: sched-ext-scx
%description %description
A Libadwaita rust based application for managing and installing kernels. A Libadwaita rust based application for managing and installing kernels.
@ -42,8 +44,8 @@ Config files to enable coprs/bieszczaders/kernel-cachyos in fedora-kernel-manage
%files cachyos-config %files cachyos-config
%{_prefix}/lib/fedora-kernel-manager/kernel_branches/kernel-cachyos.json %{_prefix}/lib/fedora-kernel-manager/kernel_branches/kernel-cachyos.json
%{_datadir}/polkit-1/actions/fdm.kernel.cachyos.init.policy %{_datadir}/polkit-1/actions/fkm.kernel.cachyos.init.policy
%{_datadir}/polkit-1/rules.d/99-fdm.kernel.cachyos.init.rules %{_datadir}/polkit-1/rules.d/99-fkm.kernel.cachyos.init.rules
%prep %prep
%autosetup -p1 -n nobara-drivers-gtk4 %autosetup -p1 -n nobara-drivers-gtk4
@ -56,5 +58,5 @@ DESTDIR=%{buildroot} make install
%{_bindir}/* %{_bindir}/*
%{_datadir}/applications/* %{_datadir}/applications/*
%{_datadir}/icons/hicolor/scalable/apps/*.svg %{_datadir}/icons/hicolor/scalable/apps/*.svg
%{_datadir}/polkit-1/actions/fdm.change.scx.policy %{_datadir}/polkit-1/actions/fkm.change.scx.policy
%{_datadir}/polkit-1/actions/fdm.modify.package.policy %{_datadir}/polkit-1/actions/fkm.modify.package.policy

View File

@ -149,14 +149,18 @@ pub fn content(
.height_request(50) .height_request(50)
.width_request(50) .width_request(50)
.tooltip_text(t!("config_kernel_button_tooltip_text")) .tooltip_text(t!("config_kernel_button_tooltip_text"))
.sensitive(is_scx_kernel())
.hexpand(true) .hexpand(true)
.build(); .build();
config_kernel_button.add_css_class("circular"); config_kernel_button.add_css_class("circular");
if !is_scx_kernel() { if !is_scx_kernel() {
config_kernel_button.set_sensitive(false);
config_kernel_button config_kernel_button
.set_tooltip_text(Some(&t!("config_kernel_button_tooltip_text_no_scx").to_string())); .set_tooltip_text(Some(&t!("config_kernel_button_tooltip_text_no_scx").to_string()));
} else if is_scx_kernel() && !is_scx_installed() {
config_kernel_button.set_sensitive(false);
config_kernel_button
.set_tooltip_text(Some(&t!("config_kernel_button_tooltip_text_no_scx_installed").to_string()));
} }
config_kernel_button.connect_clicked(clone!(@weak content_stack, @weak window, @weak sched_ext_badge_box => move |_| { config_kernel_button.connect_clicked(clone!(@weak content_stack, @weak window, @weak sched_ext_badge_box => move |_| {
@ -588,3 +592,12 @@ fn create_current_sched_badge(
&kernel_badges_size_group1, &kernel_badges_size_group1,
))); )));
} }
fn is_scx_installed() -> bool {
match Command::new("rpm")
.args(["-q", "sched-ext-scx"])
.output() {
Ok(t) if t.status.success() => true,
_ => false
}
}