diff --git a/installer/linux/build-appimage.sh b/installer/linux/build-appimage.sh index 8d28439..f2d114c 100644 --- a/installer/linux/build-appimage.sh +++ b/installer/linux/build-appimage.sh @@ -160,11 +160,12 @@ if [[ ! -f "$CLI" ]]; then bash "$HERE/usr/lib/mayros/install-cli.sh" fi -# Onboard if needed -ONBOARD_MARKER="$HOME/.mayros/.onboarded" -if [[ ! -f "$ONBOARD_MARKER" ]]; then - echo "Configuring Mayros for first use..." - "$NODE" "$CLI" onboard --non-interactive --defaults 2>/dev/null || true +# Minimal config: gateway.mode=local + auth.mode=none (portal wizard configures auth later) +CONFIG_FILE="$HOME/.mayros/mayros.json" +if [[ -f "$CONFIG_FILE" ]]; then + "$NODE" -e "const fs=require('fs');const f='$CONFIG_FILE';const c=JSON.parse(fs.readFileSync(f,'utf8'));if(!c.gateway)c.gateway={};if(!c.gateway.mode)c.gateway.mode='local';if(!c.gateway.auth)c.gateway.auth={};if(!c.gateway.auth.mode)c.gateway.auth.mode='none';fs.writeFileSync(f,JSON.stringify(c,null,2));" 2>/dev/null || true +else + echo '{"gateway":{"mode":"local","auth":{"mode":"none"}}}' > "$CONFIG_FILE" fi # Start Cortex if not running and wait for it diff --git a/installer/linux/build-deb.sh b/installer/linux/build-deb.sh index 27bc8de..d421e7f 100644 --- a/installer/linux/build-deb.sh +++ b/installer/linux/build-deb.sh @@ -153,14 +153,28 @@ exec /opt/mayros/node/bin/node /opt/mayros/lib/node_modules/@apilium/mayros/dist EOF chmod +x /opt/mayros/bin/mayros -# Run onboarding for the installing user +# Minimal config: gateway.mode=local + auth.mode=none (portal wizard configures auth later) if [ -n "$SUDO_USER" ]; then - su - "$SUDO_USER" -c "/opt/mayros/bin/mayros onboard --non-interactive --defaults" || true + MAYROS_DIR="/home/$SUDO_USER/.mayros" + su - "$SUDO_USER" -c "mkdir -p '$MAYROS_DIR'" + CONFIG_FILE="$MAYROS_DIR/mayros.json" + if [ -f "$CONFIG_FILE" ]; then + su - "$SUDO_USER" -c "/opt/mayros/node/bin/node -e \"const fs=require('fs');const f='$CONFIG_FILE';const c=JSON.parse(fs.readFileSync(f,'utf8'));if(!c.gateway)c.gateway={};if(!c.gateway.mode)c.gateway.mode='local';if(!c.gateway.auth)c.gateway.auth={};if(!c.gateway.auth.mode)c.gateway.auth.mode='none';fs.writeFileSync(f,JSON.stringify(c,null,2));\"" || true + else + su - "$SUDO_USER" -c "echo '{\"gateway\":{\"mode\":\"local\",\"auth\":{\"mode\":\"none\"}}}' > '$CONFIG_FILE'" + fi su - "$SUDO_USER" -c "systemctl --user daemon-reload" || true su - "$SUDO_USER" -c "systemctl --user enable mayros-gateway.service" || true su - "$SUDO_USER" -c "systemctl --user start mayros-gateway.service" || true else - /opt/mayros/bin/mayros onboard --non-interactive --defaults || true + MAYROS_DIR="$HOME/.mayros" + mkdir -p "$MAYROS_DIR" + CONFIG_FILE="$MAYROS_DIR/mayros.json" + if [ -f "$CONFIG_FILE" ]; then + /opt/mayros/node/bin/node -e "const fs=require('fs');const f='$CONFIG_FILE';const c=JSON.parse(fs.readFileSync(f,'utf8'));if(!c.gateway)c.gateway={};if(!c.gateway.mode)c.gateway.mode='local';if(!c.gateway.auth)c.gateway.auth={};if(!c.gateway.auth.mode)c.gateway.auth.mode='none';fs.writeFileSync(f,JSON.stringify(c,null,2));" || true + else + echo '{"gateway":{"mode":"local","auth":{"mode":"none"}}}' > "$CONFIG_FILE" + fi fi echo "" diff --git a/installer/macos/build-dmg.sh b/installer/macos/build-dmg.sh index ec59bc3..cb2272d 100644 --- a/installer/macos/build-dmg.sh +++ b/installer/macos/build-dmg.sh @@ -130,7 +130,6 @@ NPM="$RESOURCES/node/bin/npm" CORTEX="$RESOURCES/bin/aingle-cortex" MAYROS_DIR="$HOME/.mayros" CLI="$MAYROS_DIR/lib/node_modules/@apilium/mayros/dist/index.js" -ONBOARD_MARKER="$MAYROS_DIR/.onboarded" LOG="$MAYROS_DIR/install.log" SETUP_SCRIPT="$MAYROS_DIR/.mayros-setup.sh" @@ -214,17 +213,31 @@ fi echo " ✓ CLI wrapper created" echo "" -# Step 5: Onboard +# Step 5: Configure gateway (skip onboard so portal wizard shows) echo " [5/6] Running initial configuration..." -"$NODE" "$CLI" onboard --non-interactive --defaults 2>/dev/null || true -touch "$MAYROS_DIR/.onboarded" +# Minimal config: gateway.mode=local + auth.mode=none (portal wizard configures auth later) +CONFIG_FILE="$MAYROS_DIR/mayros.json" +if [[ -f "\$CONFIG_FILE" ]]; then + "$NODE" -e " + const fs = require('fs'); + const f = '\$CONFIG_FILE'; + const c = JSON.parse(fs.readFileSync(f, 'utf8')); + if (!c.gateway) c.gateway = {}; + if (!c.gateway.mode) c.gateway.mode = 'local'; + if (!c.gateway.auth) c.gateway.auth = {}; + if (!c.gateway.auth.mode) c.gateway.auth.mode = 'none'; + fs.writeFileSync(f, JSON.stringify(c, null, 2)); + " 2>/dev/null || true +else + echo '{\"gateway\":{\"mode\":\"local\",\"auth\":{\"mode\":\"none\"}}}' > "\$CONFIG_FILE" +fi echo " ✓ Configuration complete" echo "" # Step 6: Start services echo " [6/6] Starting services..." if ! pgrep -f "aingle-cortex" >/dev/null 2>&1; then - "$MAYROS_DIR/bin/aingle-cortex" --port 19090 &>/dev/null & + "$MAYROS_DIR/bin/aingle-cortex" --port 19090 >> "$LOG" 2>&1 & fi echo -n " Waiting for Cortex." for i in \$(seq 1 20); do @@ -235,7 +248,8 @@ done echo " ✓" if ! pgrep -f "mayros gateway" >/dev/null 2>&1; then - "$NODE" "$CLI" gateway start --background 2>/dev/null & + "$NODE" "$CLI" gateway install 2>/dev/null || true + "$NODE" "$CLI" gateway start 2>/dev/null & fi echo -n " Waiting for Gateway." for i in \$(seq 1 30); do @@ -283,7 +297,8 @@ fi # Start Gateway if not running if ! pgrep -f "mayros gateway" >/dev/null 2>&1; then - "$NODE" "$CLI" gateway start --background 2>/dev/null & + "$NODE" "$CLI" gateway install 2>/dev/null || true + "$NODE" "$CLI" gateway start 2>/dev/null & for i in $(seq 1 20); do curl -s --max-time 2 "http://127.0.0.1:18789/health" >/dev/null 2>&1 && break sleep 1 diff --git a/installer/windows/build-installer.ps1 b/installer/windows/build-installer.ps1 index 2897194..73f634d 100644 --- a/installer/windows/build-installer.ps1 +++ b/installer/windows/build-installer.ps1 @@ -123,9 +123,12 @@ if errorlevel 1 ( exit /b 1 ) echo Configuring Mayros for first use... -call "%MAYROS_DIR%\mayros.cmd" onboard --non-interactive --defaults -if errorlevel 1 ( - echo WARNING: initial configuration had issues, but installation will continue. +:: Minimal config: gateway.mode=local + auth.mode=none (portal wizard configures auth later) +set "CONFIG_FILE=%MAYROS_DIR%\mayros.json" +if not exist "%CONFIG_FILE%" ( + echo {"gateway":{"mode":"local","auth":{"mode":"none"}}} > "%CONFIG_FILE%" +) else ( + "%MAYROS_DIR%\node\node.exe" -e "const fs=require('fs');const f=process.argv[1];const c=JSON.parse(fs.readFileSync(f,'utf8'));if(!c.gateway)c.gateway={};if(!c.gateway.mode)c.gateway.mode='local';if(!c.gateway.auth)c.gateway.auth={};if(!c.gateway.auth.mode)c.gateway.auth.mode='none';fs.writeFileSync(f,JSON.stringify(c,null,2));" "%CONFIG_FILE%" 2>nul ) echo. echo Starting Cortex...