|
|
|
@ -845,19 +845,20 @@ impl Update {
|
|
|
|
|
|
|
|
|
|
fn is_deb_package(&self) -> bool {
|
|
|
|
|
// First check if we're in a typical Debian installation path
|
|
|
|
|
let in_system_path = self.extract_path
|
|
|
|
|
let in_system_path = self
|
|
|
|
|
.extract_path
|
|
|
|
|
.to_str()
|
|
|
|
|
.map(|p| p.starts_with("/usr"))
|
|
|
|
|
.unwrap_or(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if !in_system_path {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Then verify it's actually a Debian-based system by checking for dpkg
|
|
|
|
|
let dpkg_exists = std::path::Path::new("/var/lib/dpkg").exists();
|
|
|
|
|
let apt_exists = std::path::Path::new("/etc/apt").exists();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Additional check for the package in dpkg database
|
|
|
|
|
let package_in_dpkg = if let Ok(output) = std::process::Command::new("dpkg")
|
|
|
|
|
.args(["-S", &self.extract_path.to_string_lossy()])
|
|
|
|
@ -867,7 +868,7 @@ impl Update {
|
|
|
|
|
} else {
|
|
|
|
|
false
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Consider it a deb package only if:
|
|
|
|
|
// 1. We're in a system path AND
|
|
|
|
|
// 2. We have Debian package management tools AND
|
|
|
|
|