diff --git a/config.example.toml b/config.example.toml index 8cb618ef..bcaa9c7e 100644 --- a/config.example.toml +++ b/config.example.toml @@ -70,6 +70,7 @@ #emerge_sync_flags = "-q" #emerge_update_flags = "-uDNa --with-bdeps=y world" #redhat_distro_sync = false +#rpm_ostree = false [windows] # Manually select Windows updates diff --git a/src/config.rs b/src/config.rs index 0a0afd20..c4415aef 100644 --- a/src/config.rs +++ b/src/config.rs @@ -159,6 +159,7 @@ pub struct Linux { apt_arguments: Option, enable_tlmgr: Option, redhat_distro_sync: Option, + rpm_ostree: Option, emerge_sync_flags: Option, emerge_update_flags: Option, } @@ -669,6 +670,16 @@ impl Config { .unwrap_or(false) } + /// Use rpm-ostree in *when rpm-ostree is detected* (default: true) + #[allow(dead_code)] + pub fn rpm_ostree(&self) -> bool { + self.config_file + .linux + .as_ref() + .and_then(|linux| linux.rpm_ostree) + .unwrap_or(true) + } + /// Should we ignore failures for this step pub fn ignore_failure(&self, step: Step) -> bool { self.config_file diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 38d75233..7c23bef2 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -237,15 +237,17 @@ fn upgrade_arch_linux(ctx: &ExecutionContext) -> Result<()> { } fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> { - if let Some(ostree) = Path::new("/usr/bin/rpm-ostree").if_exists() { - let mut command = ctx.run_type().execute(ostree); - command.arg("upgrade"); - if ctx.config().yes() { - command.arg("-y"); - } + let _ = if let Some(ostree) = Path::new("/usr/bin/rpm-ostree").if_exists() { + if ctx.config().rpm_ostree() { + let mut command = ctx.run_type().execute(ostree); + command.arg("upgrade"); + if ctx.config().yes() { + command.arg("-y"); + } - return command.check_run(); - } + return command.check_run(); + } + }; if let Some(sudo) = &ctx.sudo() { let mut command = ctx.run_type().execute(&sudo);