Use systemctl disable not enable, don't auto revert in no-confirm

This commit is contained in:
Ana Hobden 2022-11-08 13:43:06 -08:00
parent fb4d1c7280
commit 6ef10ff50e
2 changed files with 10 additions and 4 deletions

View file

@ -90,9 +90,13 @@ impl Action for StartSystemdUnit {
tracing::debug!("Stopping systemd unit");
// TODO(@Hoverbear): Handle proxy vars
execute_command(Command::new("systemctl").arg("stop").arg(format!("{unit}")))
.await
.map_err(|e| StartSystemdUnitError::Command(e).boxed())?;
execute_command(
Command::new("systemctl")
.arg("disable")
.arg(format!("{unit}")),
)
.await
.map_err(|e| StartSystemdUnitError::Command(e).boxed())?;
tracing::trace!("Stopped systemd unit");
*action_state = ActionState::Completed;

View file

@ -65,8 +65,10 @@ impl CommandExecute for Install {
if !interaction::confirm(plan.describe_revert(explain)).await? {
interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await;
}
plan.revert().await?
} else {
return Err(err).wrap_err("Install failure");
}
plan.revert().await?
}
Ok(ExitCode::SUCCESS)