-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathlaunch_retropie.sh
More file actions
executable file
·50 lines (39 loc) · 1.17 KB
/
launch_retropie.sh
File metadata and controls
executable file
·50 lines (39 loc) · 1.17 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
#!/bin/bash
# TARS System Retrogaming Protocol
# Atomikspace
[ "$EUID" -eq 0 ] && exit 1
TARS_DIR="$HOME/TARS-AI"
TARS_WAS_RUNNING=false
echo "=== RetroPie launch ==="
TARS_PID=$(pgrep -f "python.*App-Start.py" | head -1)
if [ -n "$TARS_PID" ]; then
TARS_WAS_RUNNING=true
TARS_PGID=$(ps -o pgid= -p "$TARS_PID" | tr -d ' ')
echo "Waiting for TARS (PID=$TARS_PID, PGID=$TARS_PGID) to shut down..."
for i in $(seq 1 10); do
kill -0 "$TARS_PID" 2>/dev/null || break
sleep 1
done
if kill -0 "$TARS_PID" 2>/dev/null; then
echo "Forcing entire process group..."
kill -9 -"$TARS_PGID" 2>/dev/null
sleep 1
fi
pkill -9 -f "App-Start.py" 2>/dev/null
pkill -9 -f "module_btcontroller" 2>/dev/null
echo "TARS stopped."
fi
sleep 1
unset WAYLAND_DISPLAY
unset SDL_VIDEODRIVER
export DISPLAY=:0
echo "Launching emulationstation.sh..."
/opt/retropie/supplementary/emulationstation/emulationstation.sh
echo "EmulationStation exited."
if [ "$TARS_WAS_RUNNING" = true ]; then
echo "Restarting TARS..."
export WAYLAND_DISPLAY=wayland-0
cd "$TARS_DIR"
source src/.venv/bin/activate
exec python App-Start.py
fi