forked from RetroPie/RetroPie-Setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
retropie_packages.sh
executable file
·77 lines (58 loc) · 2.05 KB
/
retropie_packages.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
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
#!/usr/bin/env bash
# This file is part of The RetroPie Project
#
# The RetroPie Project is the legal property of its developers, whose names are
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
#
# See the LICENSE.md file at the top-level directory of this distribution and
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
#
# global variables ==========================================================
# main retropie install location
rootdir="/opt/retropie"
user="$SUDO_USER"
[[ -z "$user" ]] && user=$(id -un)
home="$(eval echo ~$user)"
datadir="$home/RetroPie"
biosdir="$datadir/BIOS"
romdir="$datadir/roms"
emudir="$rootdir/emulators"
configdir="$rootdir/configs"
scriptdir=$(dirname "$0")
scriptdir=$(cd "$scriptdir" && pwd)
__logdir="$scriptdir/logs"
__tmpdir="$scriptdir/tmp"
__builddir="$__tmpdir/build"
__swapdir="$__tmpdir"
# check, if sudo is used
if [[ $(id -u) -ne 0 ]]; then
echo "Script must be run as root. Try 'sudo $0'"
exit 1
fi
__backtitle="PetRockBlock.com - RetroPie Setup. Installation folder: $rootdir for user $user"
source "$scriptdir/scriptmodules/system.sh"
source "$scriptdir/scriptmodules/helpers.sh"
source "$scriptdir/scriptmodules/inifuncs.sh"
source "$scriptdir/scriptmodules/packages.sh"
setup_env
# if joy2key.py is installed run it with cursor keys for axis, and enter + space for buttons 0 and 1
__joy2key_dev=$(ls -1 /dev/input/js* 2>/dev/null | head -n1)
if [[ -f "$rootdir/supplementary/runcommand/joy2key.py" && -n "$__joy2key_dev" ]] && ! pgrep -f joy2key.py >/dev/null; then
"$rootdir/supplementary/runcommand/joy2key.py" "$__joy2key_dev" 1b5b44 1b5b43 1b5b41 1b5b42 0a 20 & 2>/dev/null
__joy2key_pid=$!
fi
mkUserDir "$romdir"
mkUserDir "$biosdir"
rp_registerAllModules
ensureFBMode 320 240
[[ "$1" == "init" ]] && return
if [[ $# -gt 0 ]]; then
ensureRootdirExists
rp_callModule "$@"
else
rp_printUsageinfo
fi
printMsgs "console" "${__INFMSGS[@]}"
if [[ -n $__joy2key_pid ]]; then
kill -INT $__joy2key_pid 2>/dev/null
fi