Full repo add backend

This commit is contained in:
Ward from fusion-voyager-3 2024-09-21 23:30:53 +03:00
parent 6ab9b48579
commit db5dd9a843

View File

@ -615,10 +615,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 {
Ok(_) => {}
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/{}.source", repo_file_name).into()) {
Ok(_) => {
match duct::cmd!("pkexec", "mv", "-vf", format!("/tmp/{}.source", repo_file_name), new_repo.filepath).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"))