forked from OpenRA/ra2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch-content.sh
executable file
·38 lines (34 loc) · 943 Bytes
/
fetch-content.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
#!/bin/bash
# Die on any error for Travis CI to automatically retry:
set -e
function download_url() {
URL="$1"
LOCAL_FILE="${1##*/}"
if [ -x "$(type -P wget)" ]; then
wget -O "${LOCAL_FILE}" "${URL}"
elif [ -x "$(type -P curl)" ]; then
curl -f -o "${LOCAL_FILE}" "${URL}"
else
echo "No supported download method found." 1>&2
return 1
fi
}
if [ "$(uname)" == "Darwin" ]; then
DIR="$HOME/Library/Application Support/OpenRA/Content/ra2"
else
DIR="$HOME/.openra/Content/ra2"
fi
#if the directory already exists then exit
[ ! -d "${DIR}" ] && mkdir -p "${DIR}" || {
cd "${DIR}"
#only exit if there's existing content
if ls *.mix &> /dev/null; then
exit 0
fi
}
echo "Downloading RA2 mod content"
cd "${DIR}"
#download the file else exit non-zero
download_url "http://xwis.net/downloads/Red-Alert-2-Multiplayer.exe"
7z e Red-Alert-2-Multiplayer.exe
rm *.exe *.dll *.DLL *.wav *.mmp *.CFG *.WAR *.cache