From 8de74a64d4936b0270702a0ced8b0fd0a692f121 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Sun, 3 Jun 2018 16:12:16 +0300 Subject: [PATCH] Launch fwupdmgr (fix #4) --- README.md | 1 + src/main.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 89fc8b89..ecde4d18 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Just invoke `topgrade`. It will invoke the following steps: * *Arch*: Invoke [yay](https://github.com/Jguer/yay) or fall back to pacman * *Redhat based*: Invoke `yum upgrade` * *Debian based*: Invoke `apt update && apt dist-upgrade` +* *Linux*: Invoke [fwupdmgr](https://github.com/hughsie/fwupd) to show firmware upgrade. (View only. No upgrades will actually be performed) * *Linux*: Run [needrestart](https://github.com/liske/needrestart) * *macOS*: Upgrade [Homebrew](https://brew.sh/) packages * *macOS*: Upgrade App Store applications diff --git a/src/main.rs b/src/main.rs index 79ed88ab..1217d54b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -193,6 +193,15 @@ fn run() -> Result<()> { _ => (), } + if let Ok(fwupdmgr) = which("fwupdmgr") { + terminal.print_separator("Firmware upgrades"); + Command::new(&fwupdmgr) + .arg("refresh") + .spawn()? + .wait()? + .and_then(|| Command::new(&fwupdmgr).arg("get-updates").spawn()?.wait())?; + } + if let Ok(sudo) = &sudo { if let Ok(needrestart) = which("needrestart") { terminal.print_separator("Check for needed restarts");