Handle Redhat and Debian systems
This commit is contained in:
@@ -24,6 +24,8 @@ Just invoke `topgrade`. It will invoke the following steps:
|
|||||||
* Upgrade Emacs packages
|
* Upgrade Emacs packages
|
||||||
* *Linux*: Invoke the system package manager:
|
* *Linux*: Invoke the system package manager:
|
||||||
* *Arch*: Invoke [yay](https://github.com/Jguer/yay) or fall back to pacman
|
* *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)
|
* *Linux*: Run [needrestart](https://github.com/liske/needrestart)
|
||||||
* *macOS*: Upgrade [Homebrew](https://brew.sh/) packages
|
* *macOS*: Upgrade [Homebrew](https://brew.sh/) packages
|
||||||
* *macOS*: Upgrade App Store applications
|
* *macOS*: Upgrade App Store applications
|
||||||
|
|||||||
28
src/main.rs
28
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()
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user