-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-rick
More file actions
223 lines (209 loc) · 6.41 KB
/
Copy pathinstall-rick
File metadata and controls
223 lines (209 loc) · 6.41 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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#
# Rick Dangerous Libretro installer and updater for GameShell
#
#
# variables
#
XR_BIN_FILE=/home/cpi/apps/emulators/xrick_libretro.so
XR_GIT_SOURCE=https://github.com/libretro/xrick-libretro.git
XR_CLONE_DIR=/tmp/xrick-libretro
XR_DATA_DIR=/home/cpi/games/xrick
XR_NAME=RickDangerous
XR_LAUNCHER_DIR_1=/home/cpi/apps/launcher
XR_LAUNCHER_DIR_2=/home/cpi/launcher
XR_MENU=Menu/GameShell
XR_MENU_RETRO="20_Retro Games"
XR_MENU_APPS=Apps
XR_MENU_ICON=skin/default/Menu/GameShell
XR_ICON_1=https://raw.githubusercontent.com/sbielmann/gameshell-installers/master/icons/xrick_bw1.png
XR_ICON_2=https://raw.githubusercontent.com/sbielmann/gameshell-installers/master/icons/xrick_bw2.png
XR_ICON_3=https://raw.githubusercontent.com/sbielmann/gameshell-installers/master/icons/xrick_col1.png
XR_ICON_APP=https://raw.githubusercontent.com/sbielmann/gameshell-installers/master/icons/apps.png
#
# set launcher paths, either old OS 0.1 or new style OS 0.2 and more recent
#
if [ -d ${XR_LAUNCHER_DIR_1} ]
then
XR_MENU_BASE=${XR_LAUNCHER_DIR_1}/${XR_MENU}
XR_MENU_ICON_BASE=${XR_LAUNCHER_DIR_1}/${XR_MENU_ICON}
else
if [ -d ${XR_LAUNCHER_DIR_2} ]
then
XR_MENU_BASE=${XR_LAUNCHER_DIR_2}/${XR_MENU}
XR_MENU_ICON_BASE=${XR_LAUNCHER_DIR_2}/${XR_MENU_ICON}
fi
fi
#
# print some welcome text, check whether we install for the first time
# or for an update, and let user choose menu item location and icon
#
echo ""
echo "=================================================="
echo " Rick Dangerous installer"
echo "=================================================="
echo ""
echo "Press Control and C keys anytime to interrupt the installation"
echo ""
echo "GameShell needs to be connected to the internet, it will"
echo "download the core source and icons during installation"
echo ""
XR_DO_UPDATE=0
XR_MENU_CHOICE="0"
XR_ICON_CHOICE="0"
if [ -f ${XR_BIN_FILE} ]
then
XR_DO_UPDATE=1
echo "Game is already installed, will update it"
else
while [ "${XR_MENU_CHOICE}" != "a" ] && [ "${XR_MENU_CHOICE}" != "b" ] && [ "${XR_MENU_CHOICE}" != "c" ]
do
echo ""
echo "Where would you like to put the game menu item?"
echo " a - Top Level"
echo " b - Apps"
echo " c - Retro Games"
echo "Apps will be created if not yet existing, with icon from Micro007."
echo -n "Your choice (a,b,c): "
read XR_MENU_CHOICE
done
while [ "${XR_ICON_CHOICE}" != "a" ] && [ "${XR_ICON_CHOICE}" != "b" ] && [ "${XR_ICON_CHOICE}" != "c" ]
do
echo ""
echo "Which icon for the game would you like to install?"
echo " a - Default black & white"
echo " b - Aluqard black & white"
echo " c - Aluqard color"
echo -n "Your choice (a,b,c): "
read XR_ICON_CHOICE
done
echo ""
fi
#
# helper function to print out different texts for installation or update
# Arguments:
# - Text to print when installing
# - Text to print when updating
#
function printInstallOrUpdate() {
if [ ${XR_DO_UPDATE} -eq 0 ]
then
echo $1
else
echo $2
fi
}
#
# download game data and source, if not already, compile if not already
# install it or update existing installation
#
if [ ! -d ${XR_CLONE_DIR} ]
then
echo "Downloading game core source..."
git clone ${XR_GIT_SOURCE} ${XR_CLONE_DIR} >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo ""
echo "ERROR: Unable to download game cour source, please check internet connection"
echo ""
cd - >/dev/null 2>&1
return 1
fi
else
echo "Game core source already downloaded"
fi
cd ${XR_CLONE_DIR} >/dev/null 2>&1
echo "Compiling game core, takes about 1 minute..."
make >/dev/null 2>&1
chmod -x xrick_libretro.so
printInstallOrUpdate "Installing game core" "Updating game core"
cp xrick_libretro.so ${XR_BIN_FILE}
printInstallOrUpdate "Installing game data file" "Updating game data file"
mkdir -p ${XR_DATA_DIR}
cp data.zip ${XR_DATA_DIR}
#
# create launcher menu with icon, however only when installing
#
XR_APP_ICON_IMAGE=""
if [ ${XR_DO_UPDATE} -eq 0 ]
then
echo "Configuring menu item..."
case ${XR_MENU_CHOICE} in
"b")
XR_MENU=${XR_MENU_BASE}/${XR_MENU_APPS}
XR_MENU_ICON=${XR_MENU_ICON_BASE}/${XR_MENU_APPS}
# special case, we also have to ensure that
# apps is existing
if [ ! -d ${XR_MENU} ]
then
echo "Apps menu not found, will create it..."
mkdir -p ${XR_MENU}
mkdir -p ${XR_MENU_ICON}
echo "Downloading and installing Apps icon..."
XR_APP_ICON_IMAGE=${XR_MENU_ICON_BASE}/${XR_MENU_APPS}.png
wget -O ${XR_APP_ICON_IMAGE} ${XR_ICON_APP} >/dev/null 2>&1
fi
;;
"c")
XR_MENU="${XR_MENU_BASE}/${XR_MENU_RETRO}"
XR_MENU_ICON="${XR_MENU_ICON_BASE}/${XR_MENU_RETRO}"
;;
*)
XR_MENU=${XR_MENU_BASE}
XR_MENU_ICON=${XR_MENU_ICON_BASE}
;;
esac
XR_MENU_ITEM="${XR_MENU}/${XR_NAME}.sh"
XR_MENU_ICON_IMAGE="${XR_MENU_ICON}/${XR_NAME}.png"
echo "retroarch -L ${XR_BIN_FILE} ${XR_DATA_DIR}/data.zip" > "${XR_MENU_ITEM}"
chmod +x "${XR_MENU_ITEM}"
echo "Downloading and installing menu icon..."
case ${XR_ICON_CHOICE} in
"b")
XR_ICON=${XR_ICON_2}
;;
"c")
XR_ICON=${XR_ICON_3}
;;
*)
XR_ICON=${XR_ICON_1}
;;
esac
wget -O "${XR_MENU_ICON_IMAGE}" ${XR_ICON} >/dev/null 2>&1
fi
#
# head back to start directory and tell user that script
# is completed, either installing or updating
#
cd - >/dev/null 2>&1
echo ""
echo "=================================================="
echo ""
if [ ${XR_DO_UPDATE} -eq 0 ]
then
echo " Rick Dangerous installed"
echo ""
echo "Installed files:"
echo " ${XR_BIN_FILE}"
echo " ${XR_DATA_DIR}/data.zip"
echo " ${XR_MENU_ITEM}"
echo " ${XR_MENU_ICON_IMAGE}"
if [ "XX${XR_APP_ICON_IMAGE}" != "XX" ]
then
echo " ${XR_APP_ICON_IMAGE}"
fi
echo ""
echo ""
echo " Please start RetroArch and quit"
echo " it again to reset menu contents"
echo " or reboot your Gameshell"
else
echo " Rick Dangerous updated"
echo ""
echo "Updated files:"
echo " ${XR_BIN_FILE}"
echo " ${XR_DATA_DIR}/data.zip"
echo ""
echo ""
echo " Game is ready to play"
fi
echo ""