From 98a99284b35de655b9b5a88a8f388b2e2110cb06 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Thu, 30 Jul 2020 08:15:35 +0300 Subject: [PATCH] Skip needrestart on redhat based distributions (fix #485) (#488) --- src/steps/os/linux.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 83b95076..954b07d1 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -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 { @@ -450,6 +457,12 @@ fn upgrade_nixos(sudo: &Option, 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");