-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathentrypointtv.sh
114 lines (84 loc) · 1.92 KB
/
entrypointtv.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
#!/bin/bash
set -e
if [ "${DEBUG}" = "true" ]; then
set -x
fi
shopt -s extglob
steam_dir="${HOME}/Steam"
server_dir="${HOME}/server"
server_installed_lock_file="${server_dir}/installed.lock"
wf_dir="${server_dir}/basewf"
wf_custom_configs_dir="${WF_CUSTOM_CONFIGS_DIR-"/var/wf"}"
install() {
echo '> Installing server ...'
set -x
$steam_dir/steamcmd.sh \
+force_install_dir $server_dir \
+login anonymous \
+app_update 1136510 validate \
+quit
set +x
echo '> Done'
touch $server_installed_lock_file
}
sync_custom_files() {
echo "> Checking for custom files at \"$wf_custom_configs_dir\" ..."
if [ -d "$wf_custom_configs_dir" ]; then
echo "> Found custom files. Syncing with \"${wf_dir}\" ..."
set -x
cp -asf $wf_custom_configs_dir/* $wf_dir # Copy custom files as soft links
find $wf_dir -xtype l -delete # Find and delete broken soft links
set +x
echo '> Done'
else
echo '> No custom files found'
fi
}
start() {
echo '> Starting server ...'
optionalParameters=""
cd $wf_dir/..
set -x
exec ./wftv_server.x86_64 \
$optionalParameters \
$WF_PARAMS
}
update() {
if [ "${VALIDATE_SERVER_FILES-"false"}" = "true" ]; then
echo '> Validating server files and checking for server update ...'
else
echo '> Checking for server update ...'
fi
if [ "${VALIDATE_SERVER_FILES-"false"}" = "true" ]; then
set -x
$steam_dir/steamcmd.sh \
+force_install_dir $server_dir \
+login anonymous \
+app_update 1136510 validate \
+quit
set +x
else
set -x
$steam_dir/steamcmd.sh \
+force_install_dir $server_dir \
+login anonymous \
+app_update 1136510 \
+quit
set +x
fi
echo '> Done'
}
install_or_update() {
if [ -f "$server_installed_lock_file" ]; then
update
else
install
fi
}
if [ ! -z $1 ]; then
$1
else
install_or_update
sync_custom_files
start
fi