Skip to content

Commit

Permalink
feat(efiboot): make efiboot boot delete return failure if nothing s…
Browse files Browse the repository at this point in the history
…ucceded
  • Loading branch information
iTrooz committed Oct 19, 2023
1 parent 4a5c556 commit 66c3cee
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions efiboot/src/cli/boot/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ pub fn run(manager: &mut dyn VarManager, id: u16) -> ExitCode {
// in this function, we assume that boot entry presence and boot order id presence are not correlated,
// so we need to remove both of them, no matter if one of these steps raises an error

let mut result = ExitCode::FAILURE;

// delete the entry
match manager.delete(&Variable::new(&id.boot_var_name())) {
Ok(_) => println!("Deleted entry with success"),
Ok(_) => {
println!("Deleted entry with success");
result = ExitCode::SUCCESS;
}
Err(efivar::Error::VarNotFound { var: _ }) => eprintln!("Boot entry not found"),
Err(err) => eprintln!("Failed to delete entry: {}", err),
}
Expand All @@ -21,7 +26,9 @@ pub fn run(manager: &mut dyn VarManager, id: u16) -> ExitCode {
eprintln!("Failed to remove id from boot order");
} else {
manager.set_boot_order(ids).unwrap();
eprintln!("Removed id from boot order");
result = ExitCode::SUCCESS;
}

ExitCode::SUCCESS
result
}

0 comments on commit 66c3cee

Please sign in to comment.