-
Notifications
You must be signed in to change notification settings - Fork 1
/
prepare_dst_server.sh
executable file
·133 lines (99 loc) · 4.24 KB
/
prepare_dst_server.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
## dependency: files/dont-starve-headless.sh
## dependency: files/update-dont-starve.sh
cd `dirname $0`
. ./common.sh
usage="
Prepares Don't Starve Together dedicated server.
Usage:
$(basename $0) [--cluster-token <token>] [--cluster-name <name>] [--server-mod-collection <nr>]
[--help] [--debug] [--log <output file>]
where
--cluster-token <token> - Cluster token (defaults to 'gpMrs7hckCBAnHn2lAdcgEQFcbTigcxv')
--cluster-name <name> - Name of the clustre (defaults to WAM)
--server-mod-collection <nr> - Steam number of the mod collection to install on server
--debug - Flag that sets debugging mode.
--log - Path to the log file that will log all meaningful commands
Example2:
$(basename $0) --debug
"
#if [ -z "$1" ]; then
# echo "$usage" >&2
# exit 0
#fi
set -x
user="$USER"
cluster_token="gpMrs7hckCBAnHn2lAdcgEQFcbTigcxv"
cluster_name="WAM"
server_mod_collection="404903250"
while [[ $# > 0 ]]
do
key="$1"
shift
case $key in
--debug)
debug=1
;;
--log)
log=$1
shift
;;
--help)
echo "$usage"
exit 0
;;
--cluster-token)
cluster_token="$1"
shift
;;
--cluster-name)
cluster_name="$1"
shift
;;
--server-mod-collection)
server_mod_collection="$1"
shift
;;
-*)
echo "Error: Unknown option: $1" >&2
echo "$usage" >&2
exit 1
;;
esac
done
if ! dpkg -s "steamcmd">/dev/null 2> /dev/null; then
sudo dpkg --add-architecture i386
sudo debconf-set-selections <<< 'steamcmd steam/license boolean true'
sudo debconf-set-selections <<< 'steamcmd steam/question string I AGREE'
add_apt_source_manual partner "deb http://archive.canonical.com/ubuntu $(get_ubuntu_codename) partner"
install_apt_packages steamcmd
fi
if [ ! -d /opt/dst ]; then
logmkdir /opt/dst $USER
fi
if [ ! -f /opt/dst/bin/dontstarve_dedicated_server_nullrenderer ]; then
logexec steamcmd +login anonymous +force_install_dir /opt/dst +app_update 343050 validate +quit
fi
home=$(get_home_dir ${USER})
install_apt_packages lib32gcc1 libcurl4-gnutls-dev:i386
install_script files/dont-starve-headless.sh ${home}
install_script files/update-dont-starve.sh ${home}
logmkdir "${home}/.klei/DoNotStarveTogether/${cluster_name}/Main" ${USER}
logmkdir "${home}/.klei/DoNotStarveTogether/${cluster_name}/11" ${USER}
logmkdir "${home}/.klei/DoNotStarveTogether/${cluster_name}/12" ${USER}
logmkdir "${home}/.klei/DoNotStarveTogether/${cluster_name}/13" ${USER}
linetextfile ${home}/.klei/DoNotStarveTogether/${cluster_name}/dedicated_server_mods_setup.lua "ServerModCollectionSetup(\"${server_mod_collection}\")"
install_file files/dst_cluster.ini ${home}/.klei/DoNotStarveTogether/${cluster_name}/cluster.ini ${USER}
install_file files/dst_modoverrides.lua ${home}/.klei/DoNotStarveTogether/${cluster_name}/Main/modoverrides.lua ${USER}
#textfile files/dst_cluster.ini ${home}/.klei/DoNotStarveTogether/${cluster_name}/cluster.ini
install_file files/dst_server1.ini ${home}/.klei/DoNotStarveTogether/${cluster_name}/Main/server.ini ${USER}
install_file files/dst_server2.ini ${home}/.klei/DoNotStarveTogether/${cluster_name}/11/server.ini ${USER}
install_file files/dst_server3.ini ${home}/.klei/DoNotStarveTogether/${cluster_name}/12/server.ini ${USER}
install_file files/dst_server4.ini ${home}/.klei/DoNotStarveTogether/${cluster_name}/13/server.ini ${USER}
install_file files/dst_worldgenoverride1.lua ${home}/.klei/DoNotStarveTogether/${cluster_name}/Main/worldgenoverride.lua ${USER}
install_file files/dst_worldgenoverride2.lua ${home}/.klei/DoNotStarveTogether/${cluster_name}/11/worldgenoverride.lua ${USER}
install_file files/dst_worldgenoverride3.lua ${home}/.klei/DoNotStarveTogether/${cluster_name}/12/worldgenoverride.lua ${USER}
install_file files/dst_worldgenoverride4.lua ${home}/.klei/DoNotStarveTogether/${cluster_name}/13/worldgenoverride.lua ${USER}
make_symlink ${home}/.klei/DoNotStarveTogether/${cluster_name}/Main/modoverrides.lua ${home}/.klei/DoNotStarveTogether/${cluster_name}/11/modoverrides.lua
make_symlink ${home}/.klei/DoNotStarveTogether/${cluster_name}/Main/modoverrides.lua ${home}/.klei/DoNotStarveTogether/${cluster_name}/12/modoverrides.lua
make_symlink ${home}/.klei/DoNotStarveTogether/${cluster_name}/Main/modoverrides.lua ${home}/.klei/DoNotStarveTogether/${cluster_name}/13/modoverrides.lua