fix package modification
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 1m56s
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 1m56s
This commit is contained in:
parent
58717a3a56
commit
8aada8758e
2
.github/release-nest-v3
vendored
2
.github/release-nest-v3
vendored
@ -1 +1 @@
|
|||||||
2
|
3
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if dpkg -s "$1"
|
if [[ "$1" == "install" ]]
|
||||||
then
|
then
|
||||||
apt remove -y "$1"
|
apt install -y "${@:2}"
|
||||||
apt autremove -y
|
|
||||||
else
|
else
|
||||||
apt install -y "$1"
|
apt remove -y "${@:2}"
|
||||||
|
apt autoremove -y
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
|||||||
pika-kernel-manager (0.1.3-101pika1) pika; urgency=low
|
pika-kernel-manager (0.1.3-101pika2) pika; urgency=low
|
||||||
|
|
||||||
* Initial Release
|
* Initial Release
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ fn add_package_rows(
|
|||||||
let log_loop_sender_clone= log_loop_sender.clone();
|
let log_loop_sender_clone= log_loop_sender.clone();
|
||||||
let kernel_packages_clone = kernel_packages.clone();
|
let kernel_packages_clone = kernel_packages.clone();
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
|
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone, true);
|
||||||
match command {
|
match command {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
println!("{}", t!("log_status_kernel_modify_successful"));
|
println!("{}", t!("log_status_kernel_modify_successful"));
|
||||||
@ -433,7 +433,7 @@ fn add_package_rows(
|
|||||||
let log_loop_sender_clone= log_loop_sender.clone();
|
let log_loop_sender_clone= log_loop_sender.clone();
|
||||||
let kernel_packages_clone = kernel_packages.clone();
|
let kernel_packages_clone = kernel_packages.clone();
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
|
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone, false);
|
||||||
match command {
|
match command {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
println!("{}", t!("log_status_kernel_modify_successful"));
|
println!("{}", t!("log_status_kernel_modify_successful"));
|
||||||
@ -479,17 +479,29 @@ fn add_package_rows(
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const KERNEL_MODIFY_PROG: &str = r###"
|
const KERNEL_INSTALL_PROG: &str = r###"
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
PACKAGE="$0"
|
PACKAGE="$0"
|
||||||
pkexec /usr/lib/pika/kernel-manager/scripts/modify_package.sh "${PACKAGE}"
|
pkexec /usr/lib/pika/kernel-manager/scripts/modify_package.sh install "${PACKAGE}"
|
||||||
|
"###;
|
||||||
|
|
||||||
|
const KERNEL_REMOVE_PROG: &str = r###"
|
||||||
|
#! /bin/bash
|
||||||
|
PACKAGE="$0"
|
||||||
|
pkexec /usr/lib/pika/kernel-manager/scripts/modify_package.sh remove "${PACKAGE}"
|
||||||
"###;
|
"###;
|
||||||
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,
|
||||||
|
install: bool
|
||||||
) -> Result<(), std::boxed::Box<dyn Error + Send + Sync>> {
|
) -> Result<(), std::boxed::Box<dyn Error + Send + Sync>> {
|
||||||
|
let kernel_modify_prog = if install {
|
||||||
|
KERNEL_INSTALL_PROG
|
||||||
|
} else {
|
||||||
|
KERNEL_REMOVE_PROG
|
||||||
|
};
|
||||||
let (pipe_reader, pipe_writer) = os_pipe::pipe()?;
|
let (pipe_reader, pipe_writer) = os_pipe::pipe()?;
|
||||||
let child = cmd!("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