From 6ef10ff50ea62b16495fac094825d6f919f163d1 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 13:43:06 -0800 Subject: [PATCH] Use systemctl disable not enable, don't auto revert in no-confirm --- src/action/linux/start_systemd_unit.rs | 10 +++++++--- src/cli/subcommand/install.rs | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/action/linux/start_systemd_unit.rs b/src/action/linux/start_systemd_unit.rs index 7f36f57..5a21f77 100644 --- a/src/action/linux/start_systemd_unit.rs +++ b/src/action/linux/start_systemd_unit.rs @@ -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; diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index 1d69d4e..4d544d3 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -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)