forked from adafruit/Adafruit-Retrogame
/
retrogame.sh
executable file
·39 lines (39 loc) · 1.01 KB
/
retrogame.sh
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
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: retrogame
# Required-Start:
# Required-Stop:
# Default-Start: 2
# Default-Stop: 6
# Short-Description: Virtual keyboard from GPIO
# Description: Run retrogame from Adafruit Industries/Pixel located in /opt/init to create a virtual keyboard which reads directly from GPIO to creates keypress events.
### END INIT INFO
modprobe evdev
modprobe uinput
do_start() {
start-stop-daemon -S --background -m --pidfile=/var/run/retrogame.pid --exec /opt/system/retrogame
exit 0
}
case "$1" in
start|"")
echo -n "Starting Retrogame..."
do_start
echo "Done!"
;;
stop)
echo -n "Killing Retrogame..."
start-stop-daemon -K --pidfile=/var/run/retrogame.pid retrogame
echo "Done!"
;;
restart)
echo -n "Stopping Retrogame..."
start-stop-daemon -K --pidfile=/var/run/retrogame.pid retrogame
echo "Done!"
echo -n "Starting Retrogame..."
do_start
;;
*)
echo "Usage: retrogame {start|stop|restart}"
exit 3
;;
esac