Skip to content

Commit

Permalink
fix: fix Mist (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC authored Jun 5, 2023
1 parent 470231c commit a7ddf45
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions src/steps/os/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,25 +439,37 @@ 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() {
Some(PathBuf::from("mist"))
} else {
None
}
})
.or_else(|| {
if Path::new("/usr/bin/nala").exists() {
Some(Path::new("/usr/bin/nala").to_path_buf())
} else {
None
}
})
.unwrap_or_else(|| PathBuf::from("apt-get"));
let apt = which("apt-fast")
.or_else(|| {
if which("mist").is_some() {
Some(PathBuf::from("mist"))
} else {
None
}
})
.or_else(|| {
if Path::new("/usr/bin/nala").exists() {
Some(Path::new("/usr/bin/nala").to_path_buf())
} else {
None
}
})
.unwrap_or_else(|| PathBuf::from("apt-get"));

let is_mist = apt.ends_with("mist");
let is_nala = apt.ends_with("nala");

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)
Expand Down

0 comments on commit a7ddf45

Please sign in to comment.