fix repos

This commit is contained in:
Ward from fusion-voyager-3 2024-09-22 21:10:01 +03:00
parent db5dd9a843
commit 1b2ecf10fd
2 changed files with 40 additions and 2 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)));
};
@ -617,9 +618,9 @@ pub fn apt_manage_page(
if sign_method == 2 {
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()) {
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
Ok(_) => {
match duct::cmd!("pkexec", "mv", "-vf", format!("/tmp/{}.source", repo_file_name), new_repo.filepath).run() {
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()
@ -659,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" => {