From 81fb8801558feec726998d61766d65e80eeca7b8 Mon Sep 17 00:00:00 2001 From: Funky185540 Date: Sun, 26 Dec 2021 10:42:09 +0100 Subject: [PATCH] Linux: System: Fix rpm-ostree detection (#816) On a rpm-ostree based system, topgrade would previously fail to detect the rpm-ostree executable and fall back to yum instead, which isn't available. This was caused by constructing a Path instance with `Path::new`, rather than querying the underlying OS for a path to the rpm-ostree executable. Make the `system` update step use `which` to determine if an executable called "rpm-ostree" is available on the system and get the correct path to the executable. --- src/steps/os/linux.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 596af639..7dbe5b46 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -157,7 +157,7 @@ fn upgrade_alpine_linux(ctx: &ExecutionContext) -> Result<()> { } fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> { - let _ = if let Some(ostree) = Path::new("rpm-ostree").if_exists() { + if let Some(ostree) = which("rpm-ostree") { if ctx.config().rpm_ostree() { let mut command = ctx.run_type().execute(ostree); command.arg("upgrade");