Compare commits

...

2 Commits

Author SHA1 Message Date
Ward from fusion-voyager-3
1b2ecf10fd fix repos 2024-09-22 21:10:01 +03:00
Ward from fusion-voyager-3
db5dd9a843 Full repo add backend 2024-09-21 23:30:53 +03:00
2 changed files with 70 additions and 4 deletions

7
data/move_repo.sh Normal file
View File

@ -0,0 +1,7 @@
#! /bin/bash
if [[ "$1" == "deb822" ]]
then
mv -vf "/tmp/"$2".sources" "/etc/apt/sources.list.d/"$2".sources"
else
mv -vf "/tmp/"$2".list" "/etc/apt/sources.list.d/"$2".list"
fi

View File

@ -117,6 +117,7 @@ pub fn apt_manage_page(
}
for deb822_source in unofficial_deb822_sources {
dbg!(&deb822_source);
unofficial_sources_list_store.append(&BoxedAnyObject::new(AptSourceConfig::DEB822(deb822_source)));
};
@ -615,10 +616,38 @@ pub fn apt_manage_page(
..Default::default()
};
if sign_method == 2 {
let key_download_cmd = duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/wget.sh", &unofficial_source_add_signed_entry.text().to_string(), &format!("/etc/apt/keyrings/{}.gpg.key", repo_file_name))
.run();
match key_download_cmd {
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/wget.sh", &unofficial_source_add_signed_entry.text().to_string(), &format!("/etc/apt/keyrings/{}.gpg.key", repo_file_name)).run() {
Ok(_) => {
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
Ok(_) => {
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/move_repo.sh", "deb822", repo_file_name).run() {
Ok(_) => {}
Err(e) => {
let apt_src_create_error_dialog = adw::MessageDialog::builder()
.heading(t!("apt_src_create_error_dialog_heading"))
.body(e.to_string())
.build();
apt_src_create_error_dialog.add_response(
"apt_src_create_error_dialog_ok",
&t!("apt_src_create_error_dialog_ok_label").to_string(),
);
apt_src_create_error_dialog.present();
}
}
}
Err(e) => {
let apt_src_create_error_dialog = adw::MessageDialog::builder()
.heading(t!("apt_src_create_error_dialog_heading"))
.body(e.to_string())
.build();
apt_src_create_error_dialog.add_response(
"apt_src_create_error_dialog_ok",
&t!("apt_src_create_error_dialog_ok_label").to_string(),
);
apt_src_create_error_dialog.present();
}
}
}
Err(e) => {
let key_download_error_dialog = adw::MessageDialog::builder()
.heading(t!("key_download_error_dialog_heading"))
@ -631,6 +660,36 @@ pub fn apt_manage_page(
key_download_error_dialog.present();
}
}
} else {
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
Ok(_) => {
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/move_repo.sh", "deb822", repo_file_name).run() {
Ok(_) => {}
Err(e) => {
let apt_src_create_error_dialog = adw::MessageDialog::builder()
.heading(t!("apt_src_create_error_dialog_heading"))
.body(e.to_string())
.build();
apt_src_create_error_dialog.add_response(
"apt_src_create_error_dialog_ok",
&t!("apt_src_create_error_dialog_ok_label").to_string(),
);
apt_src_create_error_dialog.present();
}
}
}
Err(e) => {
let apt_src_create_error_dialog = adw::MessageDialog::builder()
.heading(t!("apt_src_create_error_dialog_heading"))
.body(e.to_string())
.build();
apt_src_create_error_dialog.add_response(
"apt_src_create_error_dialog_ok",
&t!("apt_src_create_error_dialog_ok_label").to_string(),
);
apt_src_create_error_dialog.present();
}
}
}
}
"apt_update_dialog_ignore" => {