-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathquorum
More file actions
55 lines (46 loc) · 1.33 KB
/
Copy pathquorum
File metadata and controls
55 lines (46 loc) · 1.33 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
#!/bin/bash
# Quorum launcher - starts the terminal UI
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FRONTEND_DIR="$SCRIPT_DIR/frontend"
# Check if Python venv exists (install.sh must be run first)
if [ ! -f "$SCRIPT_DIR/.venv/bin/python" ]; then
echo ""
echo "[ERROR] Quorum is not installed."
echo ""
echo "Please run install.sh first:"
echo " ./install.sh"
echo ""
exit 1
fi
# Check if compiled JS exists
if [ ! -f "$FRONTEND_DIR/dist/index.js" ]; then
echo "Building frontend..."
cd "$FRONTEND_DIR" && npm run build
fi
# Tell Node where Python is (so frontend can spawn backend)
export QUORUM_PYTHON="$SCRIPT_DIR/.venv/bin/python"
# Signal file for spinner coordination
SIGNAL_FILE="/tmp/quorum-ready-$$"
export QUORUM_SIGNAL_FILE="$SIGNAL_FILE"
# Cleanup on exit
cleanup() {
rm -f "$SIGNAL_FILE"
}
trap cleanup EXIT
# Animated spinner that stops when signal file appears
(
frames=("⠋" "⠙" "⠹" "⠸" "⠼" "⠴" "⠦" "⠧" "⠇" "⠏")
i=0
while [ ! -f "$SIGNAL_FILE" ]; do
printf "\r\033[32m${frames[$i]} Starting Quorum...\033[0m"
i=$(( (i + 1) % 10 ))
sleep 0.08
done
printf "\r\033[K"
) &
SPINNER_PID=$!
# Run Node
node "$FRONTEND_DIR/dist/index.js"
# Cleanup spinner if still running
kill $SPINNER_PID 2>/dev/null
wait $SPINNER_PID 2>/dev/null