From 62b7f98807346439ec0c99a399e8c11065fae2d2 Mon Sep 17 00:00:00 2001 From: Marvin Lehmann Date: Sun, 20 Nov 2016 01:14:07 +0100 Subject: [PATCH] Standardized DST config function partly and cleaned up dstserver script --- DontStarveTogether/dstserver | 7 ++----- lgsm/functions/install_config.sh | 29 +++++++++++------------------ 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/DontStarveTogether/dstserver b/DontStarveTogether/dstserver index 859dbbe8f..af9f2595a 100644 --- a/DontStarveTogether/dstserver +++ b/DontStarveTogether/dstserver @@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="161111" +version="161120" ########################## ######## Settings ######## @@ -22,9 +22,7 @@ version="161111" #### Server Settings #### -## Installation Variables -# Visit the following link for more information: -# https://github.com/GameServerManagers/LinuxGSM/wiki/Don't-Starve-Together +## Installation Variables | https://github.com/GameServerManagers/LinuxGSM/wiki/Don't-Starve-Together sharding="false" master="true" shard="Master" @@ -44,7 +42,6 @@ confdir="DoNotStarveTogether" ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters fn_parms(){ parms="-bind_ip ${ip} -port ${port} -steam_master_server_port ${steammasterserverport} -steam_authentication_port ${steamauthenticationport} -persistent_storage_root ${persistentstorageroot} -conf_dir ${confdir} -cluster ${cluster} -shard ${shard}" -# -console -cluster MyDediServer -shard Master } #### LinuxGSM Settings #### diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index 9b0e5fc21..1a9bb69b3 100644 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -55,9 +55,10 @@ fn_default_config_remote(){ fn_script_log_info "copying ${servercfg} config file." if [ "${config}" == "${servercfgdefault}" ]; then cp -v "${lgsmdir}/default-configs/${config}" "${servercfgfullpath}" - elif [ "${config}" == "${networkcfgdefault}" ]; then - # ARMA 3 + elif [ "${gamename}" == "ARMA 3" ]&&[ "${config}" == "${networkcfgdefault}" ]; then cp -v "${lgsmdir}/default-configs/${config}" "${networkcfgfullpath}" + elif [ "${gamename}" == "Don't Starve Together" ]&&[ "${config}" == "${clustercfgdefault}" ]; then + cp -nv "${lgsmdir}/default-configs/${clustercfgdefault}" "${clustercfgfullpath}" else cp -v "${lgsmdir}/default-configs/${config}" "${servercfgdir}/${config}" fi @@ -65,15 +66,10 @@ fn_default_config_remote(){ sleep 1 } -# this should be somehow standardized -fn_dstconfig(){ +# Changes some variables within the default Don't Starve Together configs +fn_set_dst_config_vars(){ ## cluster.ini - # this config shouldn't be overridden - if [ ! -s "${clustercfgfullpath}" ]; then - echo "copying ${clustercfg} config file." - fn_script_log_info "copying ${clustercfg} config file." - cp -v "${lgsmdir}/default-configs/${clustercfgdefault}" "${clustercfgfullpath}" - sleep 1 + if grep -Fq "SERVERNAME" "${clustercfgfullpath}"; then echo "changing server name." fn_script_log_info "changing server name." sed -i "s/SERVERNAME/LinuxGSM/g" "${clustercfgfullpath}" @@ -88,15 +84,11 @@ fn_dstconfig(){ sed -i "s/CLUSTERKEY/${randomkey}/g" "${clustercfgfullpath}" sleep 1 else - echo "${clustercfg} already exists." - fn_script_log_info "${clustercfg} already exists." + echo "${clustercfg} is already configured." + fn_script_log_info "${clustercfg} is already configured." fi ## server.ini - echo "copying ${servercfg} config file." - fn_script_log_info "copying ${servercfg} config file." - cp -v "${lgsmdir}/default-configs/${servercfgdefault}" "${servercfgfullpath}" - sleep 1 # removing unnecessary options (dependent on sharding & shard type) if [ "${sharding}" == "false" ]; then sed -i "s/ISMASTER//g" "${servercfgfullpath}" @@ -104,7 +96,7 @@ fn_dstconfig(){ elif [ "${master}" == "true" ]; then sed -i "/SHARDNAME/d" "${servercfgfullpath}" fi - # configure settings + echo "changing shard name." fn_script_log_info "changing shard name." sed -i "s/SHARDNAME/${shard}/g" "${servercfgfullpath}" @@ -237,7 +229,8 @@ elif [ "${gamename}" == "Don't Starve Together" ]; then fn_check_cfgdir array_configs+=( cluster.ini server.ini ) fn_fetch_default_config - fn_dstconfig + fn_default_config_remote + fn_set_dst_config_vars elif [ "${gamename}" == "Double Action: Boogaloo" ]; then gamedirname="DoubleActionBoogaloo" array_configs+=( server.cfg )