From 285d6609b11b7425047b4a468a94265d311fb670 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Wed, 1 Jul 2026 19:10:25 +0000 Subject: [PATCH] Fix --only mode credential parsing for values with spaces Replace source+grep with a safe line-by-line reader so SITE_NAME and ADMIN_PASS with spaces do not get interpreted as shell commands. Also quote SITE_NAME and ADMIN_PASS in the written credentials file. Co-Authored-By: Claude Sonnet 4.6 --- install-stack.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/install-stack.sh b/install-stack.sh index e77ef79..b4993f8 100755 --- a/install-stack.sh +++ b/install-stack.sh @@ -272,10 +272,10 @@ gen_secrets() { # Hotel Manage credentials — generated $(date '+%Y-%m-%d %H:%M') # !! KEEP THIS FILE SAFE — store a copy offsite !! -SITE_NAME=${SITE_NAME} +SITE_NAME="${SITE_NAME}" DOMAIN=${DOMAIN} ADMIN_EMAIL=${ADMIN_EMAIL} -ADMIN_PASS=${ADMIN_PASS} +ADMIN_PASS="${ADMIN_PASS}" OFFICE_IP_CHECK=${OFFICE_IP} PG_SUPERPASS=${PG_SUPERPASS} @@ -956,7 +956,12 @@ if [[ "${1:-}" == "--only" ]]; then grep -qw "$ONLY" <<< "$VALID" || msg_error "Unknown service '${ONLY}'. Valid: ${VALID}" CREDS_FILE=/root/hotel-manage-credentials.txt [[ -f "$CREDS_FILE" ]] || msg_error "No credentials file at ${CREDS_FILE} — run the full installer first" - set -a; source <(grep -v '^#' "$CREDS_FILE" | grep '='); set +a + # Read key=value pairs safely — handles values that contain spaces (e.g. SITE_NAME) + while IFS= read -r line; do + [[ "$line" =~ ^[A-Z_][A-Z0-9_]*= ]] || continue + key="${line%%=*}"; value="${line#*=}" + export "$key"="$value" + done < "$CREDS_FILE" USE_FORGEJO=true [[ -f /root/.ssh/hotel-manage_deploy.pub ]] \ && MGMT_PUBKEY=$(cat /root/.ssh/hotel-manage_deploy.pub) || MGMT_PUBKEY=""