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