forked from arkmanager/ark-server-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netinstall.sh
68 lines (55 loc) · 1.89 KB
/
netinstall.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
#!/bin/bash
#
# Net Installer, used with curl
#
steamcmd_user="$1"
channel=${2:-master} # if defined by 2nd argument install the defined version, otherwise install master
shift
shift
output=/dev/null
if [ "$1" = "--verbose" ]; then
output=/dev/fd/1
shift
elif [[ "$1" =~ ^--output= ]]; then
output="${1#--output=}"
shift
fi
# Download and untar installation files
cd /tmp
COMMIT="`curl -L -k -s https://api.github.com/repos/FezVrasta/ark-server-tools/git/refs/heads/${channel} | sed -n 's/^ *"sha": "\(.*\)",.*/\1/p'`"
if [ -z "$COMMIT" ]; then
if [ "$channel" != "master" ]; then
echo "Channel ${channel} not found - trying master"
channel=master
COMMIT="`curl -L -k -s https://api.github.com/repos/FezVrasta/ark-server-tools/git/refs/heads/${channel} | sed -n 's/^ *"sha": "\(.*\)",.*/\1/p'`"
fi
fi
if [ -z "$COMMIT" ]; then
echo "Unable to retrieve latest commit"
exit 1
fi
mkdir ark-server-tools-${channel}
cd ark-server-tools-${channel}
curl -L -k -s https://github.com/FezVrasta/ark-server-tools/archive/${COMMIT}.tar.gz | tar xz
# Install ARK Server Tools
cd ark-server-tools-${COMMIT}/tools
sed -i "s|^arkstCommit='.*'$|arkstCommit='${COMMIT}'|" arkmanager
version=`<../.version`
sed -i "s|^arkstVersion=\".*\"|arkstVersion='${version}'|" arkmanager
chmod +x install.sh
bash install.sh "$steamcmd_user" "$@" >"$output" 2>&1
status=$?
rm -rf /tmp/ark-server-tools-${channel}
# Print messages
case "$status" in
"0")
echo "ARK Server Tools were correctly installed in your system inside the home directory of $steamcmd_user!"
;;
"1")
echo "Something where wrong :("
;;
"2")
echo "WARNING: A previous version of ARK Server Tools was detected in your system, your old configuration was not overwritten. You may need to manually update it."
echo "ARK Server Tools were correctly installed in your system inside the home directory of $steamcmd_user!"
;;
esac