fix update
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 2m14s
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 2m14s
This commit is contained in:
parent
525183787f
commit
0aeeeb0256
2
.github/release-nest-v3
vendored
2
.github/release-nest-v3
vendored
@ -1 +1 @@
|
|||||||
14
|
16
|
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1774,6 +1774,7 @@ dependencies = [
|
|||||||
"libadwaita",
|
"libadwaita",
|
||||||
"libflatpak",
|
"libflatpak",
|
||||||
"lock_api 0.4.12",
|
"lock_api 0.4.12",
|
||||||
|
"os_pipe",
|
||||||
"pretty-bytes",
|
"pretty-bytes",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
@ -46,4 +46,5 @@ strfmt = "0.2.4"
|
|||||||
configparser = "3.1.0"
|
configparser = "3.1.0"
|
||||||
ksni = "0.2.2"
|
ksni = "0.2.2"
|
||||||
single-instance = "0.3.3"
|
single-instance = "0.3.3"
|
||||||
|
os_pipe = "1.1.5"
|
||||||
|
|
||||||
|
6
Makefile
6
Makefile
@ -16,7 +16,8 @@ install:
|
|||||||
cp -vf data/pikman-update-manager-autostart $(DESTDIR)/usr/bin/
|
cp -vf data/pikman-update-manager-autostart $(DESTDIR)/usr/bin/
|
||||||
cp -vf data/flatpak-installer $(DESTDIR)/usr/bin/
|
cp -vf data/flatpak-installer $(DESTDIR)/usr/bin/
|
||||||
cp -vf data/software-properties-gtk $(DESTDIR)/usr/bin/
|
cp -vf data/software-properties-gtk $(DESTDIR)/usr/bin/
|
||||||
cp -vf target/release/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
# cp -vf target/release/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||||
|
cp -vf data/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||||
cp -vf target/release/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
cp -vf target/release/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||||
cp -vf data/modify_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
cp -vf data/modify_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||||
cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
|
cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
|
||||||
@ -41,7 +42,8 @@ install_no_build_debug:
|
|||||||
cp -vf data/pikman-update-manager-autostart $(DESTDIR)/usr/bin/
|
cp -vf data/pikman-update-manager-autostart $(DESTDIR)/usr/bin/
|
||||||
cp -vf data/flatpak-installer $(DESTDIR)/usr/bin/
|
cp -vf data/flatpak-installer $(DESTDIR)/usr/bin/
|
||||||
cp -vf data/software-properties-gtk $(DESTDIR)/usr/bin/
|
cp -vf data/software-properties-gtk $(DESTDIR)/usr/bin/
|
||||||
cp -vf target/debug/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
# cp -vf target/debug/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||||
|
cp -vf data/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||||
cp -vf target/debug/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
cp -vf target/debug/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||||
cp -vf data/modify_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
cp -vf data/modify_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/
|
||||||
cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
|
cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
|
||||||
|
2
data/apt_update
Normal file
2
data/apt_update
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
apt-get update -y
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
|||||||
pikman-update-manager (1.0.1-100pika5) pikauwu; urgency=medium
|
pikman-update-manager (1.0.1-100pika7) pikauwu; urgency=medium
|
||||||
|
|
||||||
* initial release
|
* initial release
|
||||||
|
|
||||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -20,7 +20,7 @@ Standards-Version: 3.9.5
|
|||||||
|
|
||||||
Package: pikman-update-manager
|
Package: pikman-update-manager
|
||||||
Architecture: linux-any
|
Architecture: linux-any
|
||||||
Pre-Depends: apt
|
Pre-Depends: apt, libglib2.0-bin
|
||||||
Depends: libadwaita-1-0,
|
Depends: libadwaita-1-0,
|
||||||
libgtk-4-1,
|
libgtk-4-1,
|
||||||
coreutils,
|
coreutils,
|
||||||
|
@ -5,15 +5,43 @@ use adw::gio::SimpleAction;
|
|||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use gtk::glib::*;
|
use gtk::glib::*;
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
//use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
||||||
use rust_apt::cache::*;
|
use rust_apt::cache::*;
|
||||||
use rust_apt::new_cache;
|
use rust_apt::new_cache;
|
||||||
use rust_apt::records::RecordField;
|
use rust_apt::records::RecordField;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::process::Command;
|
//use std::process::Command;
|
||||||
|
use std::io::BufRead;
|
||||||
|
use std::io::BufReader;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use tokio::runtime::Runtime;
|
//use tokio::runtime::Runtime;
|
||||||
|
use duct::cmd;
|
||||||
|
|
||||||
|
enum AddonChannelMsg {
|
||||||
|
LogLoopLine(String),
|
||||||
|
LogLoopStatus(bool)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn run_addon_command(
|
||||||
|
log_loop_sender: async_channel::Sender<AddonChannelMsg>,
|
||||||
|
) -> Result<(), std::boxed::Box<dyn std::error::Error + Send + Sync>> {
|
||||||
|
let (pipe_reader, pipe_writer) = os_pipe::pipe()?;
|
||||||
|
let child = cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/apt_update")
|
||||||
|
.stderr_to_stdout()
|
||||||
|
.stdout_file(pipe_writer)
|
||||||
|
.start()?;
|
||||||
|
for line in BufReader::new(pipe_reader).lines() {
|
||||||
|
let line_clone = line?;
|
||||||
|
log_loop_sender
|
||||||
|
.send_blocking(AddonChannelMsg::LogLoopLine(line_clone.clone()))
|
||||||
|
.expect("Channel needs to be opened.");
|
||||||
|
println!("{}", line_clone);
|
||||||
|
}
|
||||||
|
child.wait()?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct AptPackageSocket {
|
pub struct AptPackageSocket {
|
||||||
@ -37,13 +65,13 @@ pub fn apt_update_page(
|
|||||||
apt_update_count: &Rc<RefCell<i32>>,
|
apt_update_count: &Rc<RefCell<i32>>,
|
||||||
flatpak_update_count: &Rc<RefCell<i32>>,
|
flatpak_update_count: &Rc<RefCell<i32>>,
|
||||||
) -> gtk::Box {
|
) -> gtk::Box {
|
||||||
let (update_percent_sender, update_percent_receiver) = async_channel::unbounded::<String>();
|
/*let (update_percent_sender, update_percent_receiver) = async_channel::unbounded::<String>();
|
||||||
let update_percent_sender = update_percent_sender.clone();
|
//let update_percent_sender = update_percent_sender.clone();
|
||||||
let (update_speed_sender, update_speed_receiver) = async_channel::unbounded::<String>();
|
let (update_speed_sender, update_speed_receiver) = async_channel::unbounded::<String>();
|
||||||
let update_speed_sender = update_speed_sender.clone();
|
//let update_speed_sender = update_speed_sender.clone();
|
||||||
let (update_status_sender, update_status_receiver) = async_channel::unbounded::<String>();
|
let (update_status_sender, update_status_receiver) = async_channel::unbounded::<String>();
|
||||||
let update_status_sender = update_status_sender.clone();
|
//let update_status_sender = update_status_sender.clone();
|
||||||
let update_status_sender_clone0 = update_status_sender.clone();
|
//let update_status_sender_clone0 = update_status_sender.clone();*/
|
||||||
let (get_upgradable_sender, get_upgradable_receiver) = async_channel::unbounded();
|
let (get_upgradable_sender, get_upgradable_receiver) = async_channel::unbounded();
|
||||||
let get_upgradable_sender = get_upgradable_sender.clone();
|
let get_upgradable_sender = get_upgradable_sender.clone();
|
||||||
|
|
||||||
@ -51,7 +79,7 @@ pub fn apt_update_page(
|
|||||||
|
|
||||||
let excluded_updates_vec: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::new(Vec::new()));
|
let excluded_updates_vec: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::new(Vec::new()));
|
||||||
|
|
||||||
thread::spawn(move || {
|
/*thread::spawn(move || {
|
||||||
Runtime::new().unwrap().block_on(start_socket_server_no_log(
|
Runtime::new().unwrap().block_on(start_socket_server_no_log(
|
||||||
update_percent_sender,
|
update_percent_sender,
|
||||||
"/tmp/pika_apt_update_percent.sock",
|
"/tmp/pika_apt_update_percent.sock",
|
||||||
@ -110,7 +138,29 @@ pub fn apt_update_page(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
});*/
|
||||||
|
|
||||||
|
// TEMP APT FIX
|
||||||
|
let (log_loop_sender, log_loop_receiver) = async_channel::unbounded();
|
||||||
|
let log_loop_sender: async_channel::Sender<AddonChannelMsg> = log_loop_sender.clone();
|
||||||
|
|
||||||
|
let log_loop_sender_clone0 = log_loop_sender.clone();
|
||||||
|
let log_loop_sender_clone1 = log_loop_sender.clone();
|
||||||
|
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
let command = run_addon_command(log_loop_sender_clone0);
|
||||||
|
match command {
|
||||||
|
Ok(_) => {
|
||||||
|
println!("Status: Addon Command Successful");
|
||||||
|
log_loop_sender_clone1.send_blocking(AddonChannelMsg::LogLoopStatus(true)).expect("The channel needs to be open.");
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
println!("Status: Addon Command Failed");
|
||||||
|
log_loop_sender_clone1.send_blocking(AddonChannelMsg::LogLoopStatus(false)).expect("The channel needs to be open.");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
// End of TEMP APT FIX
|
||||||
|
|
||||||
let main_box = Box::builder()
|
let main_box = Box::builder()
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
@ -165,8 +215,26 @@ pub fn apt_update_page(
|
|||||||
.child(&packages_no_viewport_page)
|
.child(&packages_no_viewport_page)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let apt_update_dialog_child_box = Box::builder().orientation(Orientation::Vertical).build();
|
//let apt_update_dialog_child_box = Box::builder().orientation(Orientation::Vertical).build();
|
||||||
|
|
||||||
|
let log_terminal_buffer = gtk::TextBuffer::builder().build();
|
||||||
|
|
||||||
|
let log_terminal = gtk::TextView::builder()
|
||||||
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
|
.editable(false)
|
||||||
|
.buffer(&log_terminal_buffer)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let log_terminal_scroll = gtk::ScrolledWindow::builder()
|
||||||
|
.width_request(400)
|
||||||
|
.height_request(200)
|
||||||
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
|
.child(&log_terminal)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
/*
|
||||||
let apt_update_dialog_progress_bar =
|
let apt_update_dialog_progress_bar =
|
||||||
ProgressBar::builder().show_text(true).hexpand(true).build();
|
ProgressBar::builder().show_text(true).hexpand(true).build();
|
||||||
|
|
||||||
@ -184,14 +252,16 @@ pub fn apt_update_page(
|
|||||||
.margin_top(10)
|
.margin_top(10)
|
||||||
.margin_bottom(10)
|
.margin_bottom(10)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
apt_update_dialog_child_box.append(&apt_update_dialog_spinner);
|
apt_update_dialog_child_box.append(&apt_update_dialog_spinner);
|
||||||
apt_update_dialog_child_box.append(&apt_speed_label);
|
apt_update_dialog_child_box.append(&apt_speed_label);
|
||||||
apt_update_dialog_child_box.append(&apt_update_dialog_progress_bar);
|
apt_update_dialog_child_box.append(&apt_update_dialog_progress_bar);
|
||||||
|
*/
|
||||||
|
|
||||||
let apt_update_dialog = adw::MessageDialog::builder()
|
let apt_update_dialog = adw::MessageDialog::builder()
|
||||||
.transient_for(&window)
|
.transient_for(&window)
|
||||||
.extra_child(&apt_update_dialog_child_box)
|
//.extra_child(&apt_update_dialog_child_box)
|
||||||
|
.extra_child(&log_terminal_scroll)
|
||||||
.heading(t!("apt_update_dialog_heading"))
|
.heading(t!("apt_update_dialog_heading"))
|
||||||
.width_request(500)
|
.width_request(500)
|
||||||
.build();
|
.build();
|
||||||
@ -301,7 +371,7 @@ pub fn apt_update_page(
|
|||||||
bottom_bar.append(&select_button);
|
bottom_bar.append(&select_button);
|
||||||
bottom_bar.append(&update_button);
|
bottom_bar.append(&update_button);
|
||||||
|
|
||||||
let update_percent_server_context = MainContext::default();
|
/*let update_percent_server_context = MainContext::default();
|
||||||
// The main loop executes the asynchronous block
|
// The main loop executes the asynchronous block
|
||||||
update_percent_server_context.spawn_local(clone!(
|
update_percent_server_context.spawn_local(clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
@ -388,6 +458,75 @@ pub fn apt_update_page(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
*/
|
||||||
|
|
||||||
|
let update_status_server_context = MainContext::default();
|
||||||
|
// The main loop executes the asynchronous block
|
||||||
|
update_status_server_context.spawn_local(clone!(
|
||||||
|
#[strong]
|
||||||
|
apt_update_dialog,
|
||||||
|
#[strong]
|
||||||
|
log_terminal_buffer,
|
||||||
|
#[strong]
|
||||||
|
flatpak_retry_signal_action,
|
||||||
|
#[strong]
|
||||||
|
apt_update_count,
|
||||||
|
#[strong]
|
||||||
|
flatpak_update_count,
|
||||||
|
#[strong]
|
||||||
|
update_sys_tray,
|
||||||
|
async move {
|
||||||
|
while let Ok(state) = log_loop_receiver.recv().await {
|
||||||
|
match state {
|
||||||
|
AddonChannelMsg::LogLoopStatus(state) => {
|
||||||
|
match state {
|
||||||
|
true => {
|
||||||
|
get_apt_upgrades(&get_upgradable_sender);
|
||||||
|
log_terminal_buffer.delete(&mut log_terminal_buffer.start_iter(), &mut log_terminal_buffer.end_iter());
|
||||||
|
apt_update_dialog.close();
|
||||||
|
let mut flatpak_ran_once_borrow = flatpak_ran_once.borrow_mut();
|
||||||
|
if *flatpak_ran_once_borrow != true {
|
||||||
|
flatpak_retry_signal_action.activate(None);
|
||||||
|
*flatpak_ran_once_borrow = true;
|
||||||
|
}
|
||||||
|
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(&[
|
||||||
|
*apt_update_count.borrow(),
|
||||||
|
*flatpak_update_count.borrow(),
|
||||||
|
])));
|
||||||
|
}
|
||||||
|
false => {
|
||||||
|
get_apt_upgrades(&get_upgradable_sender);
|
||||||
|
//apt_update_dialog_child_box.set_visible(false);
|
||||||
|
apt_update_dialog.set_extra_child(Some(
|
||||||
|
&Image::builder()
|
||||||
|
.pixel_size(128)
|
||||||
|
.icon_name("dialog-error-symbolic")
|
||||||
|
.halign(Align::Center)
|
||||||
|
.build(),
|
||||||
|
));
|
||||||
|
apt_update_dialog
|
||||||
|
.set_title(Some(&t!("apt_update_dialog_status_failed").to_string()));
|
||||||
|
apt_update_dialog.set_response_enabled("apt_update_dialog_retry", true);
|
||||||
|
apt_update_dialog.set_response_enabled("apt_update_dialog_ignore", true);
|
||||||
|
let mut flatpak_ran_once_borrow = flatpak_ran_once.borrow_mut();
|
||||||
|
if *flatpak_ran_once_borrow != true {
|
||||||
|
flatpak_retry_signal_action.activate(None);
|
||||||
|
*flatpak_ran_once_borrow = true;
|
||||||
|
}
|
||||||
|
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(&[
|
||||||
|
*apt_update_count.borrow(),
|
||||||
|
*flatpak_update_count.borrow(),
|
||||||
|
])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AddonChannelMsg::LogLoopLine(state) => {
|
||||||
|
log_terminal_buffer.insert(&mut log_terminal_buffer.end_iter(), &("\n".to_string() + &state))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
let get_upgradable_server_context = MainContext::default();
|
let get_upgradable_server_context = MainContext::default();
|
||||||
// The main loop executes the asynchronous block
|
// The main loop executes the asynchronous block
|
||||||
|
@ -450,15 +450,13 @@ pub fn build_ui(app: &Application) {
|
|||||||
let apt_update_view_stack_bin = Bin::builder().build();
|
let apt_update_view_stack_bin = Bin::builder().build();
|
||||||
|
|
||||||
apt_retry_signal_action.connect_activate(clone!(
|
apt_retry_signal_action.connect_activate(clone!(
|
||||||
#[weak]
|
|
||||||
window,
|
|
||||||
#[strong]
|
#[strong]
|
||||||
apt_retry_signal_action,
|
window,
|
||||||
#[strong]
|
#[strong]
|
||||||
flatpak_retry_signal_action,
|
flatpak_retry_signal_action,
|
||||||
#[strong]
|
#[strong]
|
||||||
apt_update_view_stack_bin,
|
apt_update_view_stack_bin,
|
||||||
#[weak]
|
#[strong]
|
||||||
flatpak_ran_once,
|
flatpak_ran_once,
|
||||||
#[strong]
|
#[strong]
|
||||||
update_sys_tray,
|
update_sys_tray,
|
||||||
@ -466,12 +464,12 @@ pub fn build_ui(app: &Application) {
|
|||||||
apt_update_count,
|
apt_update_count,
|
||||||
#[strong]
|
#[strong]
|
||||||
flatpak_update_count,
|
flatpak_update_count,
|
||||||
move |_, _| {
|
move |action, _| {
|
||||||
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
|
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
|
||||||
window,
|
window.clone(),
|
||||||
&apt_retry_signal_action,
|
&action,
|
||||||
&flatpak_retry_signal_action,
|
&flatpak_retry_signal_action,
|
||||||
flatpak_ran_once,
|
flatpak_ran_once.clone(),
|
||||||
&update_sys_tray,
|
&update_sys_tray,
|
||||||
&apt_update_count,
|
&apt_update_count,
|
||||||
&flatpak_update_count,
|
&flatpak_update_count,
|
||||||
@ -483,7 +481,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
window.clone(),
|
window.clone(),
|
||||||
&apt_retry_signal_action,
|
&apt_retry_signal_action,
|
||||||
&flatpak_retry_signal_action,
|
&flatpak_retry_signal_action,
|
||||||
flatpak_ran_once,
|
flatpak_ran_once.clone(),
|
||||||
&update_sys_tray,
|
&update_sys_tray,
|
||||||
&apt_update_count,
|
&apt_update_count,
|
||||||
&flatpak_update_count,
|
&flatpak_update_count,
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.background-accent-bg {
|
.background-accent-bg {
|
||||||
background: @accent_bg_color;
|
# background: @accent_bg_color;
|
||||||
|
background: green;
|
||||||
|
animation:blink 1s linear infinite;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
@ -68,4 +70,12 @@
|
|||||||
|
|
||||||
.disable-outline {
|
.disable-outline {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink{
|
||||||
|
0%{opacity: 1;}
|
||||||
|
25%{opacity: 0.75;}
|
||||||
|
50%{opacity: 0.5;}
|
||||||
|
75%{opacity: 0.75;}
|
||||||
|
100%{opacity: 1;}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user