From e4b7eec79f0cd20b9e57be3b9f3b7fa4781bceea Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Jun 2026 12:39:50 +0200 Subject: [PATCH] fix: move interactive prompt before unbuffer exec so read works --- update-Nitrov3.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/update-Nitrov3.sh b/update-Nitrov3.sh index 2c57d15..658b774 100755 --- a/update-Nitrov3.sh +++ b/update-Nitrov3.sh @@ -11,6 +11,17 @@ if [ -f "$SCRIPT_DIR/.env" ]; then set +a fi +# Prompt for site URL before unbuffer exec, so interactive input works +if [ -z "${NITRO_SITE_URL:-}" ]; then + read -r -p "Enter your site URL (e.g. https://example.com): " NITRO_SITE_URL + NITRO_SITE_URL="${NITRO_SITE_URL%/}" + if [ -z "$NITRO_SITE_URL" ]; then + echo "=== ❌ NITRO_SITE_URL is required. Set it in .env or enter it now. ===" + exit 1 + fi + export NITRO_SITE_URL +fi + # Real-time output via pseudo-terminal (unbuffer from expect) if [ -z "${_UNBUFFERED:-}" ] && command -v unbuffer &> /dev/null; then export _UNBUFFERED=1 @@ -42,12 +53,6 @@ NITRO_CLIENT="${NITRO_CLIENT_SRC:-/var/www/Nitro-V3}" NITRO_RENDERER="${NITRO_RENDERER_SRC:-/var/www/Nitro_Render_V3}" NITRO_BRANCH="${NITRO_BRANCH:-main}" -# Prompt for site URL if not set, so it works on any VPS -while [ -z "${NITRO_SITE_URL:-}" ]; do - read -r -p "Enter your site URL (e.g. https://example.com): " NITRO_SITE_URL - NITRO_SITE_URL="${NITRO_SITE_URL%/}" -done - # Derive ws/wss protocol from the site scheme case "$NITRO_SITE_URL" in https://*) NITRO_WS_PROTO="wss://" ; NITRO_DOMAIN="${NITRO_SITE_URL#https://}" ;;