-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdeploy-all.sh
More file actions
executable file
·79 lines (69 loc) · 3.23 KB
/
Copy pathdeploy-all.sh
File metadata and controls
executable file
·79 lines (69 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
# deploy-all.sh — Rebuild and install all TV apps on the Samsung Frame
# Usage: ./deploy-all.sh [SAWSUBE_URL] [TV_ID]
set -e
SAWSUBE_URL="${1:-http://127.0.0.1:8000}"
TV_ID="${2:-1}"
LOG="/tmp/sawsube.log"
echo "=== SAWSUBE deploy-all ==="
echo " SAWSUBE: $SAWSUBE_URL"
echo " TV ID: $TV_ID"
echo ""
# ── Ensure SAWSUBE is running ────────────────────────────────────────────────
if ! curl -sf "$SAWSUBE_URL/api/health" > /dev/null 2>&1; then
echo "SAWSUBE not reachable — starting it..."
(cd "$(dirname "$0")" && nohup .venv/bin/python -m backend.main >> "$LOG" 2>&1 &)
sleep 4
if ! curl -sf "$SAWSUBE_URL/api/health" > /dev/null 2>&1; then
echo "ERROR: SAWSUBE failed to start. Check $LOG" >&2
exit 1
fi
echo "SAWSUBE started OK."
else
echo "SAWSUBE already running."
fi
echo ""
# ── Deploy Fieshzen ──────────────────────────────────────────────────────────
echo "→ [1/2] Building + installing Fieshzen (music player)..."
R=$(curl -sf -X POST "$SAWSUBE_URL/api/tizenbrew/$TV_ID/build-install-fieshzen")
echo " Job: $(echo "$R" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('job_id','?'))" 2>/dev/null)"
echo ""
# Wait for Fieshzen to complete before starting Radarrzen
echo " Waiting for Fieshzen install to complete..."
for i in $(seq 1 36); do
sleep 10
if tail -5 "$LOG" | grep -q "successfully installed\|crashed\|ERROR"; then
break
fi
echo " ...still building ($((i*10))s)"
done
if tail -10 "$LOG" | grep -q "successfully installed"; then
echo " ✓ Fieshzen installed."
elif tail -10 "$LOG" | grep -q "crashed\|ERROR"; then
echo " ✗ Fieshzen install failed — check $LOG" >&2
echo " Continuing with Radarrzen anyway..."
fi
echo ""
# ── Deploy Radarrzen ─────────────────────────────────────────────────────────
echo "→ [2/3] Building + installing Radarrzen (Radarr browser)..."
R=$(curl -sf -X POST "$SAWSUBE_URL/api/tizenbrew/$TV_ID/build-install-radarrzen")
echo " Job: $(echo "$R" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('job_id','?'))" 2>/dev/null)"
echo ""
echo " Waiting for Radarrzen install to complete..."
for i in $(seq 1 18); do
sleep 10
if tail -5 "$LOG" | grep -q "successfully installed\|crashed\|ERROR"; then
break
fi
echo " ...still building ($((i*10))s)"
done
echo ""
# ── Deploy Sonarrzen ─────────────────────────────────────────────────────────
echo "→ [3/3] Building + installing Sonarrzen (Sonarr browser)..."
R=$(curl -sf -X POST "$SAWSUBE_URL/api/tizenbrew/$TV_ID/build-install-sonarrzen")
echo " Job: $(echo "$R" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('job_id','?'))" 2>/dev/null)"
echo ""
echo "→ Streaming log (Ctrl+C to stop watching)..."
echo " Look for: 'Tizen application is successfully installed'"
echo ""
tail -f "$LOG"