Use flatpak --system to update flatpak (fix #107)
This commit is contained in:
@@ -211,8 +211,7 @@ fn run() -> Result<(), Error> {
|
|||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
report.push_result(execute(|| linux::flatpak_user_update(run_type), opt.no_retry)?);
|
report.push_result(execute(|| linux::flatpak_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::run_snap(&sudo, run_type), opt.no_retry)?);
|
report.push_result(execute(|| linux::run_snap(&sudo, run_type), opt.no_retry)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ pub fn run_fwupdmgr(run_type: RunType) -> Option<(&'static str, bool)> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[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") {
|
if let Some(flatpak) = which("flatpak") {
|
||||||
print_separator("Flatpak User Packages");
|
print_separator("Flatpak User Packages");
|
||||||
|
|
||||||
@@ -283,6 +283,10 @@ pub fn flatpak_user_update(run_type: RunType) -> Option<(&'static str, bool)> {
|
|||||||
.execute(&flatpak)
|
.execute(&flatpak)
|
||||||
.args(&["update", "--user", "-y"])
|
.args(&["update", "--user", "-y"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
|
run_type
|
||||||
|
.execute(&flatpak)
|
||||||
|
.args(&["update", "--system", "-y"])
|
||||||
|
.check_run()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}()
|
}()
|
||||||
.is_ok();
|
.is_ok();
|
||||||
@@ -293,28 +297,6 @@ pub fn flatpak_user_update(run_type: RunType) -> Option<(&'static str, bool)> {
|
|||||||
None
|
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]
|
#[must_use]
|
||||||
pub fn run_snap(sudo: &Option<PathBuf>, run_type: RunType) -> Option<(&'static str, bool)> {
|
pub fn run_snap(sudo: &Option<PathBuf>, run_type: RunType) -> Option<(&'static str, bool)> {
|
||||||
if let Some(sudo) = sudo {
|
if let Some(sudo) = sudo {
|
||||||
|
|||||||
Reference in New Issue
Block a user