THEZYZSTUDIO commited on
Commit
5c74546
Β·
verified Β·
1 Parent(s): bcd031f

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +28 -21
start.sh CHANGED
@@ -1,39 +1,46 @@
1
  #!/bin/bash
 
 
2
  # ══════════════════════════════════════════════════
3
- # THE Z AI β€” Computer Mode Startup Script
4
- # Starts: Virtual Display β†’ Desktop β†’ Python API
5
  # ══════════════════════════════════════════════════
6
 
7
  echo "πŸ–₯️ Starting Z Computer Mode Server..."
8
 
9
- # ── 1. Start Virtual Display (1920x1080, 24-bit color) ──
10
- Xvfb :1 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset &
 
 
 
 
 
 
 
11
  XVFB_PID=$!
12
  echo "βœ… Xvfb started (PID: $XVFB_PID)"
13
- sleep 2
14
 
15
- # ── 2. Start Fluxbox window manager ──────────────────
16
- export DISPLAY=:1
17
- fluxbox &
18
  FLUX_PID=$!
19
  echo "βœ… Fluxbox started (PID: $FLUX_PID)"
20
- sleep 1
21
 
22
- # ── 3. Set wallpaper color (dark) ────────────────────
23
  xsetroot -solid "#0d0d0d" &>/dev/null || true
24
 
25
- # ── 4. Launch Firefox (ready for browsing tasks) ─────
26
- firefox --no-sandbox --display=:1 &>/dev/null &
27
- echo "βœ… Firefox launched"
28
- sleep 2
29
-
30
- # ── 5. Create Xauthority file (required by pyautogui/Xlib) ──
31
- export XAUTHORITY=/home/zai/.Xauthority
32
- touch $XAUTHORITY
33
- xauth generate :1 . trusted 2>/dev/null || true
34
- echo "βœ… Xauthority ready"
35
 
36
- # ── 6. Start Python WebSocket API Server ─────────────
37
  echo "πŸš€ Starting Python API on port ${PORT:-7860}..."
38
  cd /app
39
  exec python3 app.py
 
1
  #!/bin/bash
2
+ set -euo pipefail
3
+
4
  # ══════════════════════════════════════════════════
5
+ # THE Z AI β€” Computer Mode Startup Script (fixed)
6
+ # Starts: Virtual Display β†’ Desktop β†’ Firefox β†’ Python API
7
  # ══════════════════════════════════════════════════
8
 
9
  echo "πŸ–₯️ Starting Z Computer Mode Server..."
10
 
11
+ export DISPLAY=:1
12
+ export XAUTHORITY=/tmp/.Xauthority
13
+ export PYTHONUNBUFFERED=1
14
+
15
+ mkdir -p /tmp/.X11-unix || true
16
+ touch "$XAUTHORITY"
17
+
18
+ # ── 1. Start Virtual Display ───────────────────────
19
+ Xvfb :1 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset >/tmp/xvfb.log 2>&1 &
20
  XVFB_PID=$!
21
  echo "βœ… Xvfb started (PID: $XVFB_PID)"
22
+ sleep 3
23
 
24
+ # ── 2. Start Fluxbox window manager ────────────────
25
+ fluxbox >/tmp/fluxbox.log 2>&1 &
 
26
  FLUX_PID=$!
27
  echo "βœ… Fluxbox started (PID: $FLUX_PID)"
28
+ sleep 2
29
 
30
+ # ── 3. Set wallpaper color (dark) ──────────────────
31
  xsetroot -solid "#0d0d0d" &>/dev/null || true
32
 
33
+ # ── 4. Launch Firefox inside the display ───────────
34
+ if command -v firefox >/dev/null 2>&1; then
35
+ DISPLAY=:1 firefox --new-window about:blank >/tmp/firefox.log 2>&1 &
36
+ FIREFOX_PID=$!
37
+ echo "βœ… Firefox launched (PID: $FIREFOX_PID)"
38
+ else
39
+ echo "⚠️ Firefox not found"
40
+ fi
41
+ sleep 5
 
42
 
43
+ # ── 5. Start Python WebSocket API Server ───────────
44
  echo "πŸš€ Starting Python API on port ${PORT:-7860}..."
45
  cd /app
46
  exec python3 app.py