From e9d76d185bb53d2fe4529760b2e8930f1b770772 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Wed, 16 Jan 2019 11:28:37 +0200 Subject: [PATCH] Use flatpak --system to update flatpak (fix #107) --- src/main.rs | 3 +-- src/steps/os/linux.rs | 28 +++++----------------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/main.rs b/src/main.rs index 15fb2948..4a1f8b0f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -211,8 +211,7 @@ fn run() -> Result<(), Error> { #[cfg(target_os = "linux")] { - report.push_result(execute(|| linux::flatpak_user_update(run_type), opt.no_retry)?); - report.push_result(execute(|| linux::flatpak_global_update(&sudo, run_type), opt.no_retry)?); + report.push_result(execute(|| linux::flatpak_update(run_type), opt.no_retry)?); report.push_result(execute(|| linux::run_snap(&sudo, run_type), opt.no_retry)?); } diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 3bd99ebc..ce308577 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -274,7 +274,7 @@ pub fn run_fwupdmgr(run_type: RunType) -> Option<(&'static str, bool)> { } #[must_use] -pub fn flatpak_user_update(run_type: RunType) -> Option<(&'static str, bool)> { +pub fn flatpak_update(run_type: RunType) -> Option<(&'static str, bool)> { if let Some(flatpak) = which("flatpak") { print_separator("Flatpak User Packages"); @@ -283,6 +283,10 @@ pub fn flatpak_user_update(run_type: RunType) -> Option<(&'static str, bool)> { .execute(&flatpak) .args(&["update", "--user", "-y"]) .check_run()?; + run_type + .execute(&flatpak) + .args(&["update", "--system", "-y"]) + .check_run()?; Ok(()) }() .is_ok(); @@ -293,28 +297,6 @@ pub fn flatpak_user_update(run_type: RunType) -> Option<(&'static str, bool)> { None } -#[must_use] -pub fn flatpak_global_update(sudo: &Option, run_type: RunType) -> Option<(&'static str, bool)> { - if let Some(sudo) = sudo { - if let Some(flatpak) = which("flatpak") { - print_separator("Flatpak Global Packages"); - - let success = || -> Result<(), Error> { - run_type - .execute(&sudo) - .args(&[flatpak.to_str().unwrap(), "update", "-y"]) - .check_run()?; - Ok(()) - }() - .is_ok(); - - return Some(("Flatpak Global Packages", success)); - } - } - - None -} - #[must_use] pub fn run_snap(sudo: &Option, run_type: RunType) -> Option<(&'static str, bool)> { if let Some(sudo) = sudo {