Browse Source

reword of dst config install

Removed install settings as it complicates setup. The admin  how has to manually setup a slave shard using configs. By default LinuxGSM will setup a Master shard. Docs will need to be updated.
feature/dst-changes
Daniel Gibbs 2 years ago
parent
commit
50778477a3
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 8
      lgsm/config-default/config-lgsm/dstserver/_default.cfg
  2. 103
      lgsm/modules/install_config.sh

8
lgsm/config-default/config-lgsm/dstserver/_default.cfg

@ -9,18 +9,12 @@
#### Game Server Settings #### #### Game Server Settings ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
sharding="false"
master="true"
shard="Master"
cluster="Cluster_1" cluster="Cluster_1"
cave="false"
# Edit with care
persistentstorageroot="${HOME}/.klei" persistentstorageroot="${HOME}/.klei"
confdir="DoNotStarveTogether" confdir="DoNotStarveTogether"
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
startparameters="-persistent_storage_root ${persistentstorageroot} -conf_dir ${confdir} -cluster ${cluster} -shard ${shard}" startparameters="-persistent_storage_root ${persistentstorageroot} -conf_dir ${confdir} -cluster ${cluster}"
#### LinuxGSM Settings #### #### LinuxGSM Settings ####

103
lgsm/modules/install_config.sh

@ -38,7 +38,7 @@ fn_default_config_remote() {
for config in "${array_configs[@]}"; do for config in "${array_configs[@]}"; do
fn_fetch_file "${githuburl}/${shortname}/${config}" "${remote_fileurl_backup}" "GitHub" "Bitbucket" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nohash" fn_fetch_file "${githuburl}/${shortname}/${config}" "${remote_fileurl_backup}" "GitHub" "Bitbucket" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nohash"
done done
fn_check_cfgdir
for config in "${array_configs[@]}"; do for config in "${array_configs[@]}"; do
# every config is copied # every config is copied
echo -en "copying config file [ ${italic}${config}${default} ]" echo -en "copying config file [ ${italic}${config}${default} ]"
@ -67,6 +67,7 @@ fn_default_config_remote() {
# Copys local default config to server config location. # Copys local default config to server config location.
fn_default_config_local() { fn_default_config_local() {
fn_check_cfgdir
echo -en "copying config file [ ${italic}${servercfgdefault}${default} ]" echo -en "copying config file [ ${italic}${servercfgdefault}${default} ]"
cp -nv "${servercfgdir}/${servercfgdefault}" "${servercfgfullpath}" cp -nv "${servercfgdir}/${servercfgdefault}" "${servercfgfullpath}"
if [ "${exitcode}" != 0 ]; then if [ "${exitcode}" != 0 ]; then
@ -83,13 +84,10 @@ fn_default_config_local() {
# PASSWORD to random password # PASSWORD to random password
fn_set_config_vars() { fn_set_config_vars() {
if [ -f "${servercfgfullpath}" ]; then if [ -f "${servercfgfullpath}" ]; then
random=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs)
servername="LinuxGSM" servername="LinuxGSM"
rconpass="admin${random}"
echo -en "changing server name" echo -en "changing server name"
changes="" changes=""
# prevents var from being overwritten with the servername. # prevents the variable SERVERNAME from being overwritten with the $servername.
if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then
changes+=$(sed -i "s/SERVERNAME=SERVERNAME/SERVERNAME=${servername}/g w /dev/stdout" "${servercfgfullpath}") changes+=$(sed -i "s/SERVERNAME=SERVERNAME/SERVERNAME=${servername}/g w /dev/stdout" "${servercfgfullpath}")
elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then
@ -100,7 +98,7 @@ fn_set_config_vars() {
if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fn_print_fail_eol fn_print_fail_eol
fn_script_log_fatal "changing server name" fn_script_log_fatal "changing server name"
elif [ "$changes" != "" ]; then elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "changing server name" fn_script_log_pass "changing server name"
else else
@ -108,7 +106,9 @@ fn_set_config_vars() {
fi fi
unset changes unset changes
echo -en "changing rcon/admin password" randomstring=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs)
rconpass="admin${randomstring}"
echo -en "generating rcon/admin password"
changes="" changes=""
if [ "${shortname}" == "squad" ]; then if [ "${shortname}" == "squad" ]; then
changes+=$(sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgdir}/Rcon.cfg") changes+=$(sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgdir}/Rcon.cfg")
@ -117,10 +117,10 @@ fn_set_config_vars() {
fi fi
if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181 if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fn_print_fail_eol fn_print_fail_eol
fn_script_log_fatal "changing rcon/admin password" fn_script_log_fatal "generating rcon/admin password"
elif [ "$changes" != "" ]; then elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "changing rcon/admin password" fn_script_log_pass "generating rcon/admin password"
else else
fn_print_skip_eol_nl fn_print_skip_eol_nl
fi fi
@ -130,52 +130,35 @@ fn_set_config_vars() {
# Changes some variables within the default Don't Starve Together configs. # Changes some variables within the default Don't Starve Together configs.
fn_set_dst_config_vars() { fn_set_dst_config_vars() {
## cluster.ini servername="LinuxGSM"
if grep -Fq "SERVERNAME" "${clustercfgfullpath}"; then echo -en "changing cluster name"
echo -e "changing server name." changes=""
fn_script_log_info "changing server name." changes+=$(sed -i "s/SERVERNAME/${servername}/g" "${clustercfgfullpath}")
sed -i "s/SERVERNAME/LinuxGSM/g" "${clustercfgfullpath}" if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fn_sleep_time fn_print_fail_eol
echo -e "changing shard mode." fn_script_log_fatal "changing cluster name"
fn_script_log_info "changing shard mode." elif [ "${changes}" != "" ]; then
sed -i "s/USESHARDING/${sharding}/g" "${clustercfgfullpath}" fn_print_ok_eol_nl
fn_sleep_time fn_script_log_pass "changing cluster name"
echo -e "randomizing cluster key."
fn_script_log_info "randomizing cluster key."
randomkey=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs)
sed -i "s/CLUSTERKEY/${randomkey}/g" "${clustercfgfullpath}"
fn_sleep_time
else else
echo -e "${clustercfg} is already configured." fn_print_skip_eol_nl
fn_script_log_info "${clustercfg} is already configured."
fi
## server.ini
# removing unnecessary options (dependent on sharding & shard type).
if [ "${sharding}" == "false" ]; then
sed -i "s/ISMASTER//g" "${servercfgfullpath}"
sed -i "/SHARDNAME/d" "${servercfgfullpath}"
elif [ "${master}" == "true" ]; then
sed -i "/SHARDNAME/d" "${servercfgfullpath}"
fi fi
unset changes
echo -e "changing shard name." randomstring=$(tr -dc A-Za-z0-9 < /dev/urandom 2> /dev/null | head -c 16 | xargs)
fn_script_log_info "changing shard name." echo -en "generating cluster key"
sed -i "s/SHARDNAME/${shard}/g" "${servercfgfullpath}" changes=""
fn_sleep_time changes+=$(sed -i "s/CLUSTERKEY/${randomstring}/g" "${clustercfgfullpath}")
echo -e "changing master setting." if [ "$?" -ne 0 ]; then # shellcheck disable=SC2181
fn_script_log_info "changing master setting." fn_print_fail_eol
sed -i "s/ISMASTER/${master}/g" "${servercfgfullpath}" fn_script_log_fatal "generating cluster key"
fn_sleep_time elif [ "${changes}" != "" ]; then
fn_print_ok_eol_nl
## worldgenoverride.lua fn_script_log_pass "generating cluster key"
if [ "${cave}" == "true" ]; then else
echo -e "defining ${shard} as cave in ${servercfgdir}/worldgenoverride.lua." fn_print_skip_eol_nl
fn_script_log_info "defining ${shard} as cave in ${servercfgdir}/worldgenoverride.lua."
echo 'return { override_enabled = true, preset = "DST_CAVE", }' > "${servercfgdir}/worldgenoverride.lua"
fi fi
fn_sleep_time unset changes
echo -e ""
} }
# Lists local config file locations # Lists local config file locations
@ -215,25 +198,21 @@ elif [ "${shortname}" == "ahl2" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ark" ]; then elif [ "${shortname}" == "ark" ]; then
fn_check_cfgdir
array_configs+=(GameUserSettings.ini) array_configs+=(GameUserSettings.ini)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "arma3" ]; then elif [ "${shortname}" == "arma3" ]; then
fn_check_cfgdir
array_configs+=(server.cfg network.cfg) array_configs+=(server.cfg network.cfg)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "armar" ]; then elif [ "${shortname}" == "armar" ]; then
fn_check_cfgdir
array_configs+=(server.json) array_configs+=(server.json)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ats" ]; then elif [ "${shortname}" == "ats" ]; then
fn_check_cfgdir
array_configs+=(server_config.sii) array_configs+=(server_config.sii)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
@ -249,13 +228,11 @@ elif [ "${shortname}" == "bd" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "bt" ]; then elif [ "${shortname}" == "bt" ]; then
fn_check_cfgdir
array_configs+=(serversettings.xml) array_configs+=(serversettings.xml)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "btl" ]; then elif [ "${shortname}" == "btl" ]; then
fn_check_cfgdir
array_configs+=(DefaultGame.ini) array_configs+=(DefaultGame.ini)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
@ -361,7 +338,6 @@ elif [ "${shortname}" == "ct" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dayz" ]; then elif [ "${shortname}" == "dayz" ]; then
fn_check_cfgdir
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
@ -391,7 +367,6 @@ elif [ "${shortname}" == "dmc" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "dst" ]; then elif [ "${shortname}" == "dst" ]; then
fn_check_cfgdir
array_configs+=(cluster.ini server.ini) array_configs+=(cluster.ini server.ini)
fn_default_config_remote fn_default_config_remote
fn_set_dst_config_vars fn_set_dst_config_vars
@ -420,7 +395,6 @@ elif [ "${shortname}" == "etl" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "ets2" ]; then elif [ "${shortname}" == "ets2" ]; then
fn_check_cfgdir
array_configs+=(server_config.sii) array_configs+=(server_config.sii)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
@ -516,7 +490,6 @@ elif [ "${shortname}" == "mohaa" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "mh" ]; then elif [ "${shortname}" == "mh" ]; then
fn_check_cfgdir
array_configs+=(Game.ini) array_configs+=(Game.ini)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
@ -537,7 +510,6 @@ elif [ "${shortname}" == "nd" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "mta" ]; then elif [ "${shortname}" == "mta" ]; then
fn_check_cfgdir
array_configs+=(acl.xml mtaserver.conf vehiclecolors.conf) array_configs+=(acl.xml mtaserver.conf vehiclecolors.conf)
fn_default_config_remote fn_default_config_remote
fn_list_config_locations fn_list_config_locations
@ -547,7 +519,6 @@ elif [ "${shotname}" == "mom" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "pvr" ]; then elif [ "${shortname}" == "pvr" ]; then
fn_check_cfgdir
array_configs+=(Game.ini) array_configs+=(Game.ini)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
@ -557,13 +528,11 @@ elif [ "${shortname}" == "pvkii" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "pz" ]; then elif [ "${shortname}" == "pz" ]; then
fn_check_cfgdir
array_configs+=(server.ini) array_configs+=(server.ini)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "nec" ]; then elif [ "${shortname}" == "nec" ]; then
fn_check_cfgdir
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
@ -611,7 +580,6 @@ elif [ "${shortname}" == "rtcw" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "rust" ]; then elif [ "${shortname}" == "rust" ]; then
fn_check_cfgdir
array_configs+=(server.cfg) array_configs+=(server.cfg)
fn_default_config_remote fn_default_config_remote
fn_list_config_locations fn_list_config_locations
@ -695,7 +663,6 @@ elif [ "${shortname}" == "terraria" ]; then
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "tu" ]; then elif [ "${shortname}" == "tu" ]; then
fn_check_cfgdir
array_configs+=(TowerServer.ini) array_configs+=(TowerServer.ini)
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars

Loading…
Cancel
Save