add package version
This commit is contained in:
parent
7dda928089
commit
7b682c3359
BIN
data/scripts/core
Normal file
BIN
data/scripts/core
Normal file
Binary file not shown.
3
data/scripts/get_version.sh
Normal file
3
data/scripts/get_version.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
dnf info $1 | grep Version | cut -d":" -f2 | head -n1
|
11
data/scripts/modify_package.sh
Normal file
11
data/scripts/modify_package.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if rpm -q "$1"
|
||||||
|
then
|
||||||
|
dnf remove -y "$1"
|
||||||
|
else
|
||||||
|
dnf install -y "$1"
|
||||||
|
fi
|
||||||
|
exit 0
|
@ -130,6 +130,12 @@ fn add_package_rows(
|
|||||||
.to_owned()
|
.to_owned()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
let kernel_package_version = match Command::new("/usr/lib/fedora-kernel-manager/scripts/get_version.sh")
|
||||||
|
.args([&kernel_package])
|
||||||
|
.output() {
|
||||||
|
Ok(t) => String::from_utf8(t.stdout).unwrap(),
|
||||||
|
_ => "Error".to_owned()
|
||||||
|
};
|
||||||
|
|
||||||
let (log_loop_sender, log_loop_receiver) = async_channel::unbounded();
|
let (log_loop_sender, log_loop_receiver) = async_channel::unbounded();
|
||||||
let log_loop_sender: async_channel::Sender<String> = log_loop_sender.clone();
|
let log_loop_sender: async_channel::Sender<String> = log_loop_sender.clone();
|
||||||
@ -193,8 +199,7 @@ fn add_package_rows(
|
|||||||
kernel_remove_button.add_css_class("destructive-action");
|
kernel_remove_button.add_css_class("destructive-action");
|
||||||
kernel_expander_row.add_suffix(&kernel_status_icon);
|
kernel_expander_row.add_suffix(&kernel_status_icon);
|
||||||
kernel_expander_row.set_title(&kernel_name);
|
kernel_expander_row.set_title(&kernel_name);
|
||||||
//kernel_expander_row.set_subtitle(&kernel_package_version);
|
kernel_expander_row.set_subtitle(&kernel_package_version);
|
||||||
//
|
|
||||||
kernel_content_row.add_prefix(&kernel_description_label);
|
kernel_content_row.add_prefix(&kernel_description_label);
|
||||||
kernel_action_box.append(&kernel_remove_button);
|
kernel_action_box.append(&kernel_remove_button);
|
||||||
kernel_action_box.append(&kernel_install_button);
|
kernel_action_box.append(&kernel_install_button);
|
||||||
@ -377,26 +382,15 @@ fn add_package_rows(
|
|||||||
|
|
||||||
const KERNEL_MODIFY_PROG: &str = r###"
|
const KERNEL_MODIFY_PROG: &str = r###"
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
PACKAGE="$0"
|
PACKAGE="$0"
|
||||||
|
pkexec /usr/lib/fedora-kernel-manager/scripts/modify_package.sh "${PACKAGE}"
|
||||||
if rpm -q "${PACKAGE}"
|
|
||||||
then
|
|
||||||
dnf remove -y "${PACKAGE}"
|
|
||||||
else
|
|
||||||
dnf install -y "${PACKAGE}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
"###;
|
"###;
|
||||||
fn kernel_modify(
|
fn kernel_modify(
|
||||||
log_loop_sender: async_channel::Sender<String>,
|
log_loop_sender: async_channel::Sender<String>,
|
||||||
kernel_pkg: &str,
|
kernel_pkg: &str,
|
||||||
) -> Result<(), std::boxed::Box<dyn Error + Send + Sync>> {
|
) -> Result<(), std::boxed::Box<dyn Error + Send + Sync>> {
|
||||||
let (pipe_reader, pipe_writer) = os_pipe::pipe()?;
|
let (pipe_reader, pipe_writer) = os_pipe::pipe()?;
|
||||||
let child = cmd!("pkexec", "bash", "-c", KERNEL_MODIFY_PROG, kernel_pkg)
|
let child = cmd!("bash", "-c", KERNEL_MODIFY_PROG, kernel_pkg)
|
||||||
.stderr_to_stdout()
|
.stderr_to_stdout()
|
||||||
.stdout_file(pipe_writer)
|
.stdout_file(pipe_writer)
|
||||||
.start()?;
|
.start()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user