Handle Redhat and Debian systems

This commit is contained in:
Roey Darwish Dror
2018-06-01 14:43:16 +03:00
parent f2c9050d01
commit f6024c275d
2 changed files with 30 additions and 0 deletions

View File

@@ -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

View File

@@ -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()
})?;
}
}
_ => (),
}