Updated as per comments

pull/1991/head
jLynx 9 months ago
parent 466cdaefa5
commit 7d70f62a58

@ -2,4 +2,4 @@
"updater": "minor" "updater": "minor"
--- ---
Added support for .deb package updates on Linux systems, including new error types (TempDirNotFound, AuthenticationFailed, DebInstallFailed) and implementation of .deb package installation with privilege escalation handling. Added support for `.deb` package updates on Linux systems.

@ -883,15 +883,23 @@ impl Update {
} }
// Try different temp directories // Try different temp directories
let tmp_dir_locations = ["/tmp", "/var/tmp", "/dev/shm"]; let tmp_dir_locations = vec![
Box::new(|| Some(std::env::temp_dir())) as Box<dyn FnOnce() -> Option<PathBuf>>,
Box::new(dirs::cache_dir),
Box::new(|| Some(self.extract_path.parent().unwrap().to_path_buf())),
];
let tmp_dir = tmp_dir_locations let tmp_dir = tmp_dir_locations
.iter() .into_iter()
.find_map(|dir| { .find_map(|loc| {
tempfile::Builder::new() if let Some(path) = loc() {
.prefix("tauri_deb_update") tempfile::Builder::new()
.tempdir_in(dir) .prefix("tauri_deb_update")
.ok() .tempdir_in(path)
.ok()
} else {
None
}
}) })
.ok_or_else(|| Error::TempDirNotFound)?; .ok_or_else(|| Error::TempDirNotFound)?;
@ -901,9 +909,7 @@ impl Update {
std::fs::write(&deb_path, bytes)?; std::fs::write(&deb_path, bytes)?;
// Try different privilege escalation methods // Try different privilege escalation methods
let installation_result = self.try_install_with_privileges(&deb_path); self.try_install_with_privileges(&deb_path)
installation_result
} }
fn try_install_with_privileges(&self, deb_path: &Path) -> Result<()> { fn try_install_with_privileges(&self, deb_path: &Path) -> Result<()> {

Loading…
Cancel
Save