fix: fix Mist (#466)

This commit is contained in:
SteveLauC
2023-06-05 14:38:14 +08:00
committed by GitHub
parent 470231c9d1
commit a7ddf4575a

View File

@@ -439,7 +439,6 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> {
}
fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = &ctx.sudo() {
let apt = which("apt-fast")
.or_else(|| {
if which("mist").is_some() {
@@ -457,7 +456,20 @@ fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
})
.unwrap_or_else(|| PathBuf::from("apt-get"));
let is_mist = apt.ends_with("mist");
let is_nala = apt.ends_with("nala");
// MIST does not require `sudo`
if is_mist {
ctx.run_type().execute(&apt).arg("update").status_checked()?;
ctx.run_type().execute(&apt).arg("upgrade").status_checked()?;
// Simply return as MIST does not have `clean` and `autoremove`
// subcommands, neither the `-y` option (for now maybe?).
return Ok(());
}
if let Some(sudo) = &ctx.sudo() {
if !is_nala {
ctx.run_type()
.execute(sudo)