Separate Flatpak user from Flatpak global (fix #67)
This commit is contained in:
34
src/linux.rs
34
src/linux.rs
@@ -220,20 +220,46 @@ pub fn run_fwupdmgr(terminal: &mut Terminal, dry_run: bool) -> Option<(&'static
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn run_flatpak(terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> {
|
pub fn flatpak_user_update(terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> {
|
||||||
if let Some(flatpak) = which("flatpak") {
|
if let Some(flatpak) = which("flatpak") {
|
||||||
terminal.print_separator("Flatpak");
|
terminal.print_separator("Flatpak User Packages");
|
||||||
|
|
||||||
let success = || -> Result<(), failure::Error> {
|
let success = || -> Result<(), failure::Error> {
|
||||||
Executor::new(&flatpak, dry_run)
|
Executor::new(&flatpak, dry_run)
|
||||||
.args(&["update", "-y"])
|
.args(&["update", "--user", "-y"])
|
||||||
.spawn()?
|
.spawn()?
|
||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}().is_ok();
|
||||||
|
|
||||||
return Some(("Flatpak", success));
|
return Some(("Flatpak User Packages", success));
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn flatpak_global_update(
|
||||||
|
sudo: &Option<PathBuf>,
|
||||||
|
terminal: &mut Terminal,
|
||||||
|
dry_run: bool,
|
||||||
|
) -> Option<(&'static str, bool)> {
|
||||||
|
if let Some(sudo) = sudo {
|
||||||
|
if let Some(flatpak) = which("flatpak") {
|
||||||
|
terminal.print_separator("Flatpak Global Packages");
|
||||||
|
|
||||||
|
let success = || -> Result<(), failure::Error> {
|
||||||
|
Executor::new(&sudo, dry_run)
|
||||||
|
.args(&[flatpak.to_str().unwrap(), "update", "-y"])
|
||||||
|
.spawn()?
|
||||||
|
.wait()?
|
||||||
|
.check()?;
|
||||||
|
Ok(())
|
||||||
|
}().is_ok();
|
||||||
|
|
||||||
|
return Some(("Flatpak Global Packages", success));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|||||||
@@ -250,7 +250,11 @@ fn run() -> Result<(), Error> {
|
|||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
report.push_result(execute(
|
report.push_result(execute(
|
||||||
|terminal| linux::run_flatpak(terminal, opt.dry_run),
|
|terminal| linux::flatpak_user_update(terminal, opt.dry_run),
|
||||||
|
&mut terminal,
|
||||||
|
));
|
||||||
|
report.push_result(execute(
|
||||||
|
|terminal| linux::flatpak_global_update(&sudo, terminal, opt.dry_run),
|
||||||
&mut terminal,
|
&mut terminal,
|
||||||
));
|
));
|
||||||
report.push_result(execute(
|
report.push_result(execute(
|
||||||
|
|||||||
Reference in New Issue
Block a user