forked from MCPHackers/RetroMCP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·131 lines (109 loc) · 2.99 KB
/
setup.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
echo "Initial RetroMCP Setup"
echo ----------------------
echo
#
# Methods
#
# Download (url, path)
download() {
wget -q -O $2 $1
}
# Unpack (zip, output)
unpack() {
unzip -qqod $2 $1
}
scriptsonly() {
echo "> Setting up RetroMCP workspace..."
if [ -z "$1" ]; then
./runtime/bin/python/bin/pypy3 runtime/setup.py scriptsonly
else
echo "! Running custom python command! Some things may not work correctly!"
"$1" runtime/setup.py scriptsonly "$1"
fi
}
start() {
#
# Downloading natives
#
# PyPy 3.6.1
if [ -z "$1" ] && [ ! -d runtime/bin/python/ ]; then
echo "> Downloading PyPy 7.1.1 on Python 3.6.1"
os=$(uname)
if [ "$os" == "Darwin" ]; then
download "https://downloads.python.org/pypy/pypy3.6-v7.3.2-osx64.tar.bz2" runtime/bin/pypy.tar.bz2
elif [ "$os" == "Linux" ]; then
download "https://downloads.python.org/pypy/pypy3.6-v7.3.2-linux32.tar.bz2" runtime/bin/pypy.tar.bz2
else
echo "! You are not on a supported OS listed in the autoinstaller, unfortunately. Sorry about that :("
echo "! You may try using your own python3 install by using 'c' in setup."
exit 1
fi
fi
#
# Unzipping natives
#
if [ -z "$1" ] && [ ! -d runtime/bin/python/ ]; then
echo
echo Unzipping natives
echo "> PyPy 7.3.2 on Python 3.6.1"
tar -xjf runtime/bin/pypy.tar.bz2 -C runtime/bin/
mv runtime/bin/pypy3.6* runtime/bin/python
rm runtime/bin/pypy.tar.bz2
fi
#
# Setup RetroMCP workspace
#
echo
echo Setting up RetroMCP workspace...
if [ -z "$1" ]; then
./runtime/bin/python/bin/pypy3 runtime/setup.py
else
echo "! Running custom python command! Some things may not work correctly!"
"$1" runtime/setup.py "$1"
fi
echo
echo Finished!
exit
}
setpython() {
echo "> Enter the path to your desired python install."
read -p ": " answer
start ${answer}
}
setpythonscriptsonly() {
echo "> Enter the path to your desired python install."
read -p ": " answer
scriptsonly ${answer}
}
if [ -d runtime/bin/python/ ]; then
echo "> Input 's' if you want to only copy the .sh files."
echo "> Input 'c' if you want to use a custom python command."
echo "> Input 'i' if you want to use a custom python command and only copy the .sh files."
echo "> Are you sure you want to run the setup? [y/N/s/c/i]?"
read -p ": " answer
case "$answer" in
[yY])
start ;;
[sS])
scriptsonly ;;
[cC])
setpython ;;
[iI])
setpythonscriptsonly ;;
*)
exit ;;
esac
else
echo "> Input 'c' if you want to use a custom python command."
echo "> Are you sure you want to run the setup? [y/N/c]?"
read -p ": " answer
case "$answer" in
[yY])
start ;;
[cC])
setpython ;;
*)
exit ;;
esac
fi