From 82dcb78a857a40a1ae9adc99b77cba34cd3c9f20 Mon Sep 17 00:00:00 2001 From: Godopu Date: Tue, 23 Jun 2026 08:32:02 +0900 Subject: [PATCH] fix(deploy): refine install.sh variables, pip upgrade, permissions, and active defaults based on review --- deploy/install.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/deploy/install.sh b/deploy/install.sh index 15fe3b6..31cab3c 100644 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -30,11 +30,12 @@ check_cmd() { check_cmd tmux check_cmd python3 -check_cmd pip3 # Verify Python Version PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') -if python3 -c "import sys; exit(0 if sys.version_info >= (3, 9) else 1)"; then +PYTHON_MAJOR="${MIN_PYTHON_VERSION%%.*}" +PYTHON_MINOR="${MIN_PYTHON_VERSION##*.}" +if python3 -c "import sys; exit(0 if sys.version_info >= ($PYTHON_MAJOR, $PYTHON_MINOR) else 1)"; then echo "✅ Python $PYTHON_VERSION detected." else echo "❌ Error: Python version must be $MIN_PYTHON_VERSION or higher. Detected: $PYTHON_VERSION" >&2 @@ -46,8 +47,10 @@ cd "$TARGET_DIR" echo "📂 Ensuring metadata directory structure (.mam/)..." mkdir -p .mam/jobs .mam/delegate_job_logs -# File permission lockdown on database directory -chmod 0700 .mam +# File permission lockdown on database directory (if owned by the current user to prevent multi-user system issues) +if [ -O .mam ]; then + chmod 0700 .mam +fi # --- 3. Check Network File System (NFS) Warnings --- echo "💾 Detecting file system mount type..." @@ -77,17 +80,18 @@ fi # shellcheck disable=SC1091 source "$VENV_NAME"/bin/activate +# Upgrade pip +pip install --upgrade pip + # Install requirements REQ_FILE=".agents/skills/multi-agent-mux-delegate-job/requirements.txt" if [ -f "$REQ_FILE" ]; then echo "đŸ“Ļ Installing backplane dependencies from $REQ_FILE..." - pip install --upgrade pip pip install -r "$REQ_FILE" echo "✅ Dependencies installed successfully." else echo "âš ī¸ WARNING: Could not find requirements file: $REQ_FILE" echo " Installing default packages (paho-mqtt, pyyaml) manually..." - pip install --upgrade pip pip install "paho-mqtt>=2.0.0" pyyaml fi @@ -98,21 +102,22 @@ if [ ! -f "$ENV_FILE" ]; then if [ -f "$ENV_EXAMPLE" ]; then echo "📝 Creating configuration from $ENV_EXAMPLE..." cp "$ENV_EXAMPLE" "$ENV_FILE" - chmod 0600 "$ENV_FILE" else echo "📝 Creating default $ENV_FILE..." - cat < "$ENV_FILE" -# ============================================================================== -# Multi-Agent Mux (MAM) Environment Settings -# ============================================================================== + touch "$ENV_FILE" + fi + + # Always append the active defaults to ensure they are set and not commented out + cat <> "$ENV_FILE" + +# === Installer-applied active defaults === MQTT_BROKER=broker.hivemq.com MQTT_PORT=1883 MQTT_TLS=0 MQTT_CLIENT_ID_PREFIX=mam-agent TMUX_SERVER_NAME=default EOF - chmod 0600 "$ENV_FILE" - fi + chmod 0600 "$ENV_FILE" echo "✅ Config file .env initialized with chmod 0600." else echo "â„šī¸ $ENV_FILE already exists. Skipping config override."