From c3b7a7430eff79450c904e40ebeaedb52ce27d50 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Sun, 24 Aug 2025 15:16:46 +0000 Subject: [PATCH] fix: install script no longer prompts for port during updates The script now properly detects update scenarios by checking for: - Existing binary at /opt/pulse/bin/pulse or /opt/pulse/pulse - Existing config directory at /etc/pulse - --version flag being specified This prevents the annoying port prompt when running updates or installing specific versions. --- install.sh | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index b654f6fd5..77151244a 100755 --- a/install.sh +++ b/install.sh @@ -1083,19 +1083,26 @@ main() { ;; esac else - # Fresh installation - ask for port configuration - FRONTEND_PORT=${FRONTEND_PORT:-} - if [[ -z "$FRONTEND_PORT" ]]; then - if [[ "$IN_CONTAINER" == "true" ]]; then - # In container mode, use default port without prompting - FRONTEND_PORT=7655 - else - echo - safe_read "Frontend port [7655]: " FRONTEND_PORT - FRONTEND_PORT=${FRONTEND_PORT:-7655} - if [[ ! "$FRONTEND_PORT" =~ ^[0-9]+$ ]] || [[ "$FRONTEND_PORT" -lt 1 ]] || [[ "$FRONTEND_PORT" -gt 65535 ]]; then - print_error "Invalid port number. Using default port 7655." + # Check if this is truly a fresh installation or an update + # If binary exists OR config exists OR --version was specified, it's likely an update + if [[ -f "$INSTALL_DIR/bin/pulse" ]] || [[ -f "$INSTALL_DIR/pulse" ]] || [[ -d "$CONFIG_DIR" ]] || [[ -n "${FORCE_VERSION}" ]]; then + # This is an update/reinstall, don't prompt for port + FRONTEND_PORT=${FRONTEND_PORT:-7655} + else + # Fresh installation - ask for port configuration + FRONTEND_PORT=${FRONTEND_PORT:-} + if [[ -z "$FRONTEND_PORT" ]]; then + if [[ "$IN_CONTAINER" == "true" ]]; then + # In container mode, use default port without prompting FRONTEND_PORT=7655 + else + echo + safe_read "Frontend port [7655]: " FRONTEND_PORT + FRONTEND_PORT=${FRONTEND_PORT:-7655} + if [[ ! "$FRONTEND_PORT" =~ ^[0-9]+$ ]] || [[ "$FRONTEND_PORT" -lt 1 ]] || [[ "$FRONTEND_PORT" -gt 65535 ]]; then + print_error "Invalid port number. Using default port 7655." + FRONTEND_PORT=7655 + fi fi fi fi