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.
This commit is contained in:
@@ -157,7 +157,7 @@ fn upgrade_alpine_linux(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn upgrade_redhat(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() {
|
if ctx.config().rpm_ostree() {
|
||||||
let mut command = ctx.run_type().execute(ostree);
|
let mut command = ctx.run_type().execute(ostree);
|
||||||
command.arg("upgrade");
|
command.arg("upgrade");
|
||||||
|
|||||||
Reference in New Issue
Block a user