fix(config): resolves issue with settings not always picked up in start parameter (#3320)

This commit is contained in:
Daniel Gibbs 2021-03-06 09:57:59 +00:00 committed by GitHub
parent 9765feccb6
commit bb994660f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 25 deletions

View File

@ -165,7 +165,7 @@ fn_start_tmux(){
fn_print_ok "${servername}"
fn_script_log_pass "Started ${servername}"
fi
rm "${lgsmlogdir:?}/.${selfname}-tmux-error.tmp"
rm "${lgsmlogdir:?}/.${selfname}-tmux-error.tmp" 2>/dev/null
echo -en "\n"
}

View File

@ -39,10 +39,6 @@ else
fi
}
fn_parms(){
parms="${startparameters}"
}
core_exit.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function

View File

@ -77,3 +77,7 @@ if [ -z "${wsstartmap}" ]; then
wscollectionid="${ws_start_map}"
fi
fi
fn_parms(){
parms="${startparameters}"
}

View File

@ -116,7 +116,7 @@ fn_script_log_info(){
fi
}
## Feb 28 14:56:58 ut99-server: Monitor: INFO:
## Feb 28 14:56:58 ut99-server: Monitor: UPDATE:
fn_script_log_update(){
if [ -d "${lgsmlogdir}" ]; then
if [ -n "${commandname}" ]; then

View File

@ -96,7 +96,7 @@ fi
if [ "${commandname}" == "INSTALL" ]; then
if [ "${shortname}" == "av" ]||[ "${shortname}" == "cmw" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "samp" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then
echo -e ""
echo -e "Applying Post-Install Fixes"
echo -e "${lightyellow}Applying Post-Install Fixes}${default}"
echo -e "================================="
fn_sleep_time
postinstall=1

View File

@ -610,17 +610,7 @@ fn_info_message_commandlineparms(){
if [ "${serverpassword}" == "NOT SET" ]; then
unset serverpassword
fi
if grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/secrets-${selfname}.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/secrets-${selfname}.cfg")"
elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/${selfname}.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/${selfname}.cfg")"
elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/secrets-common.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/secrets-common.cfg")"
elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/common.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/common.cfg")"
elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/_default.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/_default.cfg")"
fi
fn_reload_startparameters
echo -e "${preexecutable} ${executable} ${startparameters}"
}

View File

@ -87,7 +87,6 @@ elif [ "${shortname}" == "pmc" ]; then
install_eula.sh
update_papermc.sh
elif [ "${shortname}" == "wmc" ]; then
install_eula.sh
update_papermc.sh
elif [ "${shortname}" == "mumble" ]; then
update_mumble.sh

View File

@ -444,18 +444,28 @@ else
# shellcheck source=/dev/null
source "${configdirserver}/secrets-${selfname}.cfg"
fi
# Use eval if startparameters are only in _default.cfg to ensure all vars in startparameters are set.
if ! grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/common.cfg" "${configdirserver}/${selfname}.cfg" "${configdirserver}/secrets-common.cfg" "${configdirserver}/secrets-${selfname}.cfg"; then
# Reloads start parameter to ensure all vars in startparameters are set.
# Will reload the last defined startparameter.
fn_reload_startparameters(){
# reload Wurm config.
if [ "${shortname}" == "wurm" ]; then
# shellcheck source=/dev/null
source "${servercfgfullpath}"
fi
if [ -n "${preexecutable}" ]; then
eval preexecutable="$(sed -nr 's/^ *preexecutable=(.*)$/\1/p' "${configdirserver}/_default.cfg")"
if grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/secrets-${selfname}.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/secrets-${selfname}.cfg")"
elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/${selfname}.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/${selfname}.cfg")"
elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/secrets-common.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/secrets-common.cfg")"
elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/common.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/common.cfg")"
elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/_default.cfg"; then
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/_default.cfg")"
fi
eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/_default.cfg")"
fi
}
# Load the linuxgsm.sh in to tmpdir. If missing download it.
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then