Use flatpak --system to update flatpak (fix #107)

This commit is contained in:
Roey Darwish Dror
2019-01-16 11:28:37 +02:00
parent d8a9111c48
commit e9d76d185b
2 changed files with 6 additions and 25 deletions

View File

@@ -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<PathBuf>, 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<PathBuf>, run_type: RunType) -> Option<(&'static str, bool)> {
if let Some(sudo) = sudo {