Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions installer/linux/build-appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 17 additions & 3 deletions installer/linux/build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
29 changes: 22 additions & 7 deletions installer/macos/build-dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions installer/windows/build-installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
Loading