|
|
|
@ -760,8 +760,6 @@ impl Update {
|
|
|
|
|
/// ### Expected structure:
|
|
|
|
|
/// ├── [AppName]_[version]_amd64.AppImage.tar.gz # GZ generated by tauri-bundler
|
|
|
|
|
/// │ └──[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
|
|
|
|
|
/// └── ...
|
|
|
|
|
///
|
|
|
|
@ -855,8 +853,6 @@ impl Update {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn install_deb_update(&self, bytes: &[u8]) -> Result<()> {
|
|
|
|
|
use flate2::read::GzDecoder;
|
|
|
|
|
|
|
|
|
|
// Create a temporary directory
|
|
|
|
|
let tmp_dir = tempfile::Builder::new()
|
|
|
|
|
.prefix("tauri_deb_update")
|
|
|
|
@ -864,30 +860,8 @@ impl Update {
|
|
|
|
|
|
|
|
|
|
let deb_path = tmp_dir.path().join("package.deb");
|
|
|
|
|
|
|
|
|
|
// Check if we need to extract from tar.gz first
|
|
|
|
|
if infer::archive::is_gz(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
|
|
|
|
|
let installation_result = self.try_install_with_privileges(&deb_path);
|
|
|
|
@ -937,7 +911,7 @@ impl Update {
|
|
|
|
|
.args([
|
|
|
|
|
"--password",
|
|
|
|
|
"--title=Authentication Required",
|
|
|
|
|
"--text=Enter your password to install the update:"
|
|
|
|
|
"--text=Enter your password to install the update:",
|
|
|
|
|
])
|
|
|
|
|
.output()?;
|
|
|
|
|
|
|
|
|
@ -949,8 +923,8 @@ impl Update {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn install_with_sudo(&self, deb_path: &Path, password: &str) -> Result<bool> {
|
|
|
|
|
use std::process::{Command, Stdio};
|
|
|
|
|
use std::io::Write;
|
|
|
|
|
use std::process::{Command, Stdio};
|
|
|
|
|
|
|
|
|
|
let mut child = Command::new("sudo")
|
|
|
|
|
.arg("-S") // read password from stdin
|
|
|
|
|