diff --git a/README.md b/README.md index ac8f80d9..a20dc89f 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ Just invoke `topgrade`. It will invoke the following steps: * Upgrade Emacs packages * *Linux*: Invoke the system package manager: * *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*: 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 8d85a879..1574db2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -156,6 +156,34 @@ fn run() -> Result<()> { } } } + + OSType::CentOS | OSType::Redhat => { + if let Ok(sudo) = &sudo { + Command::new(&sudo) + .arg("yum") + .arg("upgrade") + .spawn()? + .wait()?; + } + } + + OSType::Ubuntu | OSType::Debian => { + if let Ok(sudo) = &sudo { + Command::new(&sudo) + .arg("apt") + .arg("update") + .spawn()? + .wait()? + .and_then(|| { + Command::new(&sudo) + .arg("apt") + .arg("dist-upgrade") + .spawn()? + .wait() + })?; + } + } + _ => (), }