Add FUSE fix wizard with pkexec installation
This commit is contained in:
@@ -307,6 +307,53 @@ fn extract_os_field(content: &str, key: &str) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Get the package install command suitable for running via pkexec (no sudo prefix).
|
||||
pub fn get_fuse_install_command() -> Option<String> {
|
||||
let content = std::fs::read_to_string("/etc/os-release").ok()?;
|
||||
let id = extract_os_field(&content, "ID");
|
||||
let version_id = extract_os_field(&content, "VERSION_ID");
|
||||
let id_like = extract_os_field(&content, "ID_LIKE");
|
||||
|
||||
match id.as_deref() {
|
||||
Some("ubuntu") => {
|
||||
let ver: f64 = version_id
|
||||
.as_deref()
|
||||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(0.0);
|
||||
if ver >= 24.04 {
|
||||
Some("apt install -y libfuse2t64".to_string())
|
||||
} else {
|
||||
Some("apt install -y libfuse2".to_string())
|
||||
}
|
||||
}
|
||||
Some("debian") => Some("apt install -y libfuse2".to_string()),
|
||||
Some("fedora") => Some("dnf install -y fuse-libs".to_string()),
|
||||
Some("arch") | Some("manjaro") | Some("endeavouros") => {
|
||||
Some("pacman -S --noconfirm fuse2".to_string())
|
||||
}
|
||||
Some("opensuse-tumbleweed") | Some("opensuse-leap") => {
|
||||
Some("zypper install -y libfuse2".to_string())
|
||||
}
|
||||
_ => {
|
||||
if let Some(like) = id_like.as_deref() {
|
||||
if like.contains("ubuntu") || like.contains("debian") {
|
||||
return Some("apt install -y libfuse2".to_string());
|
||||
}
|
||||
if like.contains("fedora") {
|
||||
return Some("dnf install -y fuse-libs".to_string());
|
||||
}
|
||||
if like.contains("arch") {
|
||||
return Some("pacman -S --noconfirm fuse2".to_string());
|
||||
}
|
||||
if like.contains("suse") {
|
||||
return Some("zypper install -y libfuse2".to_string());
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if AppImageLauncher is installed (known conflicts with new runtime).
|
||||
pub fn detect_appimagelauncher() -> Option<String> {
|
||||
let output = Command::new("dpkg")
|
||||
|
||||
Reference in New Issue
Block a user