Skip needrestart on redhat based distributions (fix #485) (#488)

This commit is contained in:
Roey Darwish Dror
2020-07-30 08:15:35 +03:00
committed by GitHub
parent 4171b329ba
commit 98a99284b3

View File

@@ -109,6 +109,13 @@ impl Distribution {
show_pacnew();
}
}
pub fn redhat_based(self) -> bool {
match self {
Distribution::CentOS | Distribution::Fedora => true,
_ => false,
}
}
}
fn is_wsl() -> Result<bool> {
@@ -450,6 +457,12 @@ fn upgrade_nixos(sudo: &Option<PathBuf>, cleanup: bool, run_type: RunType) -> Re
pub fn run_needrestart(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
let sudo = require_option(sudo)?;
let needrestart = require("needrestart")?;
let distribution = Distribution::detect()?;
if distribution.redhat_based() {
debug!("Skipping needrestart on Redhat based distributions");
return Err(SkipStep.into());
}
print_separator("Check for needed restarts");