From 1e259269995405192dd24cb2ad1d6210fc927403 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Mon, 9 May 2022 06:44:39 +0300 Subject: [PATCH] Replace the apt step with nala if installed. (#914) --- src/steps/os/linux.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 82dd462c..16171038 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -283,11 +283,22 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> { fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> { if let Some(sudo) = &ctx.sudo() { - let apt = which("apt-fast").unwrap_or_else(|| PathBuf::from("apt-get")); - ctx.run_type().execute(&sudo).arg(&apt).arg("update").check_run()?; + let apt = which("apt-fast") + .or_else(|| which("nala")) + .unwrap_or_else(|| PathBuf::from("apt-get")); + + let is_nala = apt.ends_with("nala"); + if !is_nala { + ctx.run_type().execute(&sudo).arg(&apt).arg("update").check_run()?; + } let mut command = ctx.run_type().execute(&sudo); - command.arg(&apt).arg("dist-upgrade"); + command.arg(&apt); + if is_nala { + command.arg("upgrade"); + } else { + command.arg("dist-upgrade"); + }; if ctx.config().yes(Step::System) { command.arg("-y"); }