-
Notifications
You must be signed in to change notification settings - Fork 3
/
fetchRtcwPro.sh
41 lines (34 loc) · 1.2 KB
/
fetchRtcwPro.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
#!/bin/bash
set -e
desiredrelease=$1
datapath=${datapath:-"/home/game"}
mkdir -p "${datapath}"
if [ -f "/rtcwpro/server.zip" ]; then
filename="server.zip"
cp "/rtcwpro/server.zip" "/tmp/server.zip"
else
# Fetch release information
wget -O "/tmp/rtcwpro.releases" \
"https://api.github.com/repos/rtcwmp-com/rtcwPro/releases/${desiredrelease}"
# Determine file name and source of RtcwPro
asset="$(jq '.assets[] | select(.name | test("^rtcwpro_[0-9]+_server.+zip$"))' "/tmp/rtcwpro.releases")"
filename="$(echo "${asset}" | jq -r '.name')"
# Download and extract asset
wget -qO "/tmp/${filename}" "$(echo "${asset}" | jq -r '.browser_download_url')"
fi
# Unzip the content of the RTCWPro repository
unzip "/tmp/${filename}" -d "${datapath}"
# Cleanup unwanted files
rm -rf \
"/tmp/${filename}" \
"${datapath}/rtcwpro/qagame_mp_x86.dll" \
"${datapath}/libmysql.dll" \
"${datapath}/wolfDED.exe" \
"${datapath}/maps" \
"${datapath}/configs" \
"${datapath}/mapConfigs" \
"${datapath}/rtcwpro/"*.cfg \
"${datapath}/rtcwpro_127_server/" \
"/tmp/rtcwpro.releases"
chmod 0755 "${datapath}/wolfded.x86"
chmod 0755 "${datapath}/rtcwpro/qagame.mp.i386.so"