Removed gz support

pull/1991/head
jLynx 9 months ago
parent 4d4f2f8901
commit 37ec6294f8

@ -760,8 +760,6 @@ impl Update {
/// ### Expected structure: /// ### Expected structure:
/// ├── [AppName]_[version]_amd64.AppImage.tar.gz # GZ generated by tauri-bundler /// ├── [AppName]_[version]_amd64.AppImage.tar.gz # GZ generated by tauri-bundler
/// │ └──[AppName]_[version]_amd64.AppImage # Application AppImage /// │ └──[AppName]_[version]_amd64.AppImage # Application AppImage
/// ├── [AppName]_[version]_amd64.deb.tar.gz # GZ generated by tauri-bundler
/// │ └──[AppName]_[version]_amd64.deb # Debian package
/// ├── [AppName]_[version]_amd64.deb # Debian package /// ├── [AppName]_[version]_amd64.deb # Debian package
/// └── ... /// └── ...
/// ///
@ -855,8 +853,6 @@ impl Update {
} }
fn install_deb_update(&self, bytes: &[u8]) -> Result<()> { fn install_deb_update(&self, bytes: &[u8]) -> Result<()> {
use flate2::read::GzDecoder;
// Create a temporary directory // Create a temporary directory
let tmp_dir = tempfile::Builder::new() let tmp_dir = tempfile::Builder::new()
.prefix("tauri_deb_update") .prefix("tauri_deb_update")
@ -864,30 +860,8 @@ impl Update {
let deb_path = tmp_dir.path().join("package.deb"); let deb_path = tmp_dir.path().join("package.deb");
// Check if we need to extract from tar.gz first // Direct .deb file
if infer::archive::is_gz(bytes) { std::fs::write(&deb_path, bytes)?;
let decoder = GzDecoder::new(Cursor::new(bytes));
let mut archive = tar::Archive::new(decoder);
// Look for .deb file in archive
let mut found_deb = false;
for mut entry in archive.entries()?.flatten() {
if let Ok(path) = entry.path() {
if path.extension() == Some(OsStr::new("deb")) {
entry.unpack(&deb_path)?;
found_deb = true;
break;
}
}
}
if !found_deb {
return Err(Error::BinaryNotFoundInArchive);
}
} else {
// Direct .deb file
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); let installation_result = self.try_install_with_privileges(&deb_path);
@ -937,7 +911,7 @@ impl Update {
.args([ .args([
"--password", "--password",
"--title=Authentication Required", "--title=Authentication Required",
"--text=Enter your password to install the update:" "--text=Enter your password to install the update:",
]) ])
.output()?; .output()?;
@ -949,11 +923,11 @@ impl Update {
} }
fn install_with_sudo(&self, deb_path: &Path, password: &str) -> Result<bool> { fn install_with_sudo(&self, deb_path: &Path, password: &str) -> Result<bool> {
use std::process::{Command, Stdio};
use std::io::Write; use std::io::Write;
use std::process::{Command, Stdio};
let mut child = Command::new("sudo") let mut child = Command::new("sudo")
.arg("-S") // read password from stdin .arg("-S") // read password from stdin
.arg("dpkg") .arg("dpkg")
.arg("-i") .arg("-i")
.arg(deb_path) .arg(deb_path)

Loading…
Cancel
Save