From f62d110adc72618dc502be023eba8fdcf2433e90 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Mon, 29 Dec 2025 18:45:14 -0600 Subject: [PATCH] added overwrite protection --- scripts/setup_wizard.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/setup_wizard.sh b/scripts/setup_wizard.sh index da807af..de35a9d 100755 --- a/scripts/setup_wizard.sh +++ b/scripts/setup_wizard.sh @@ -102,8 +102,15 @@ install_unit() { local filename=$(basename "$template_url") local dest_path=/etc/systemd/system/"$filename" - log_info "Installing $filename..." + if [ -e "$dest_path" ]; then + get_input "CONFIRM_OVERWRITE" "Overwrite $dest_path? (y/n)" "y" "false" + if [[ "${CONFIRM_OVERWRITE,,}" != "y" ]]; then + echo "Skipping overwrite of ${dest_path}." + return + fi + fi + log_info "Installing $filename..." curl -sL $template_url | envsubst > "$dest_path" log_success "$filename installed to $dest_path" } @@ -138,7 +145,6 @@ else fi - # 1. Collect Inputs # Example: get_input "HOST_NAME" "Enter Hostname" "$(hostname)" "false"