Replace the apt step with nala if installed. (#914)
This commit is contained in:
committed by
GitHub
parent
c166d51fb8
commit
1e25926999
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user