From 875fd11982a99f2e3f0453cad3e498f7d9ce3cdd Mon Sep 17 00:00:00 2001 From: nexxo Date: Sun, 26 Jul 2026 18:49:58 +0200 Subject: [PATCH] fix(deploy): an answer file with a space in a value killed the install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The file is sourced, so ADMIN_NAME=Boban Blaskovic is read as a command and dies with "Blaskovic: command not found" — naming neither the file nor the variable — and set -e ends the install there. A display name with a space is entirely ordinary; the example just happened to use "Administrator", one word, so nobody hit it. Found while installing on the live server. Co-Authored-By: Claude Opus 5 --- deploy/clupilot.env.example | 4 +++- deploy/install.sh | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/deploy/clupilot.env.example b/deploy/clupilot.env.example index 666bc39..9bb3339 100644 --- a/deploy/clupilot.env.example +++ b/deploy/clupilot.env.example @@ -15,7 +15,9 @@ WWW_DOMAIN=www.clupilot.com # marketing site WS_DOMAIN=ws.clupilot.com # websockets (Reverb) ADMIN_DOMAIN=admin.clupilot.com # operator console — must NOT resolve publicly ADMIN_EMAIL= -ADMIN_NAME=Administrator +# Quote anything that may contain a space — this file is sourced, so an +# unquoted space is read as a command. +ADMIN_NAME="Administrator" ADMIN_PASSWORD= # at least 12 characters # ── Needed before the platform can actually do business ───────────────────── diff --git a/deploy/install.sh b/deploy/install.sh index 7e2bc3e..72d846c 100755 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -75,6 +75,22 @@ if [[ -n "${ENV_FILE:-}" ]]; then [[ "$perms" == "600" || "$perms" == "400" ]] || \ printf '\033[1;33m !\033[0m %s\n' "$ENV_FILE is mode $perms — chmod 600 it." + # The file is SOURCED, so an unquoted value containing a space is read as a + # command: `ADMIN_NAME=Boban Blaskovic` dies with "Blaskovic: command not + # found", which names neither the file nor the variable, and `set -e` ends + # the install right there. A display name with a space is entirely ordinary, + # so say so properly instead. + while IFS= read -r line || [[ -n "$line" ]]; do + case "$line" in ''|'#'*) continue ;; esac + if [[ "$line" =~ ^[A-Za-z_][A-Za-z0-9_]*=[^\"\'][^=]*[[:space:]] ]]; then + die "$ENV_FILE, this line has an unquoted value with a space in it: + + ${line%%=*}=… + + Quote it: ${line%%=*}=\"${line#*=}\"" + fi + done < "$ENV_FILE" + # shellcheck disable=SC1090 # the path is the whole point of the flag set -a; . "$ENV_FILE"; set +a fi