From f506d523094317cffc8c93f6bae1e967c17af8d3 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Wed, 20 Nov 2019 09:10:15 +0200 Subject: [PATCH] =?UTF-8?q?[=F0=9F=90=9B=20FIX]=20--cleanup=20--yes=20for?= =?UTF-8?q?=20arch=20&=20prioritize=20yay=20(#258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/steps/os/linux.rs | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index c39bd81d..bb440b20 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -152,11 +152,11 @@ fn upgrade_arch_linux( .and_then(|mut p| p.wait()) .ok(); - let mut command = run_type.execute(yay); + let mut command = run_type.execute(&yay); command .arg("--pacman") - .arg(pacman) + .arg(&pacman) .arg("-Syu") .args(yay_arguments.split_whitespace()) .env("PATH", path); @@ -165,23 +165,35 @@ fn upgrade_arch_linux( command.arg("--noconfirm"); } command.check_run()?; + + if cleanup { + let mut command = run_type.execute(&yay); + command.arg("--pacman").arg(&pacman).arg("-Scc"); + if yes { + command.arg("--noconfirm"); + } + command.check_run()?; + } } else if let Some(sudo) = &sudo { let mut command = run_type.execute(&sudo); - command.arg(pacman).arg("-Syu").env("PATH", path); + command.arg(&pacman).arg("-Syu").env("PATH", path); if yes { command.arg("--noconfirm"); } command.check_run()?; + + if cleanup { + let mut command = run_type.execute(&sudo); + command.arg(&pacman).arg("-Scc"); + if yes { + command.arg("--noconfirm"); + } + command.check_run()?; + } } else { print_warning("Neither sudo nor yay detected. Skipping system upgrade"); } - if cleanup { - if let Some(sudo) = &sudo { - run_type.execute(&sudo).args(&["/usr/bin/pacman", "-Scc"]).check_run()?; - } - } - Ok(()) }