This repository has been archived by the owner on Sep 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharchrgs_packages.sh
executable file
·79 lines (60 loc) · 1.69 KB
/
archrgs_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
78
#!/usr/bin/env bash
# This file is part of the Arch-RGS project.
#
# Please see the LICENSE file at the top-level directory of this distribution.
__version="1.8.5-BETA"
[[ "$__debug" -eq 1 ]] && set -x
##Archrgs Install Location
rootdir="/opt/archrgs"
##If __user Is Set Install For That User, Else Use sudo_user
if [[ -n "$__user" ]]; then
user="$__user"
if ! id -u "$__user" &>/dev/null; then
echo "User $__user not exist"
exit 1
fi
else
user="$SUDO_USER"
[[ -z "$user" ]] && user="$(id -un)"
fi
home="$(eval echo ~$user)"
datadir="$home/Arch-RGS"
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"
pkgdir="$scriptdir/packages"
##Check If Sudo Is Used
if [[ "$(id -u)" -ne 0 ]]; then
echo "Script must be run under sudo from the user you want to install for. Try 'sudo $0'"
exit 1
fi
__backtitle="Arch-RGS 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
archrgs_registerAllModules
archrgs_ret=0
if [[ $# -gt 0 ]]; then
setupDirectories
archrgs_callModule "$@"
archrgs_ret="$?"
else
archrgs_printUsageinfo
fi
if [[ "${#__ERRMSGS[@]}" -gt 0 ]]; then
##Override Return Code If Errmsgs Is Set
[[ "$rgs_ret" -eq 0 ]] && rgs_ret=1
printMsgs "console" "Errors:\n${__ERRMSGS[@]}"
fi
if [[ "${#__INFMSGS[@]}" -gt 0 ]]; then
printMsgs "console" "Info:\n${__INFMSGS[@]}"
fi
exit $rgs_ret