From 2f6516880b0e29deb4a8d2932d59af17cf6638ca Mon Sep 17 00:00:00 2001 From: Yury Kossakovsky Date: Thu, 25 Dec 2025 16:49:43 -0700 Subject: [PATCH] fix: preserve installation id during updates the telemetry id was being lost during updates because: 1. apply_update.sh didn't export INSTALLATION_ID 2. 03_generate_secrets.sh only checked env var, not existing .env now checks both exported var and generated_values from existing .env, and generates new id for pre-telemetry installations upgrading --- scripts/03_generate_secrets.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/03_generate_secrets.sh b/scripts/03_generate_secrets.sh index 4b9c425..af788ab 100755 --- a/scripts/03_generate_secrets.sh +++ b/scripts/03_generate_secrets.sh @@ -548,10 +548,14 @@ done log_success ".env file generated successfully in the project root ($OUTPUT_FILE)." -# Save INSTALLATION_ID if passed from install.sh (for telemetry correlation) -if [[ -n "${INSTALLATION_ID:-}" ]]; then - write_env_var "INSTALLATION_ID" "$INSTALLATION_ID" "$OUTPUT_FILE" +# Save INSTALLATION_ID for telemetry correlation +# Priority: 1) exported from parent (install.sh), 2) existing .env (via generated_values), 3) generate new +existing_install_id="${INSTALLATION_ID:-${generated_values[INSTALLATION_ID]:-}}" +if [[ -z "$existing_install_id" ]]; then + # Generate new ID for existing installations upgrading from pre-telemetry version + existing_install_id=$(od -An -tx1 -N6 /dev/urandom | tr -d ' \n') fi +write_env_var "INSTALLATION_ID" "$existing_install_id" "$OUTPUT_FILE" # Uninstall caddy apt remove -y caddy