From bd8dac6d98a4e726bf2918824c07a2d821c5df02 Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Fri, 21 Jun 2024 14:04:58 -0700 Subject: [PATCH] Make the Steam query port configurable. This is to prepare for other feature branches. --- files/serverDZ.cfg | 2 +- server/bin/dz | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/files/serverDZ.cfg b/files/serverDZ.cfg index 2bc3921..2d8685c 100644 --- a/files/serverDZ.cfg +++ b/files/serverDZ.cfg @@ -49,7 +49,7 @@ adminLogPlayerList = 0; // 1 - log periodic player list with position every 5 enableDebugMonitor = 0; // shows info about the character using a debug window in a corner of the screen (value 0-1) -//steamQueryPort = 2305; // defines Steam query port, should fix the issue with server not being visible in client server browser +steamQueryPort = 27016; // defines Steam query port, should fix the issue with server not being visible in client server browser allowFilePatching = 1; // if set to 1 it will enable connection of clients with "-filePatching" launch parameter enabled diff --git a/server/bin/dz b/server/bin/dz index e949e40..99c0edf 100755 --- a/server/bin/dz +++ b/server/bin/dz @@ -11,6 +11,7 @@ mkdir -p ${SERVER_PROFILE}/battleye SERVER_CFG_FILE="serverDZ.cfg" SERVER_CFG_DST="${SERVER_PROFILE}/${SERVER_CFG_FILE}" SERVER_CFG_SRC="${FILES}/${SERVER_CFG_FILE}" +SERVER_CFG_SAVE="${SERVER_PROFILE}/${SERVER_CFG_FILE}.save" # Command line parameters except mod, as that is handled separately. parameters="-config=${SERVER_CFG_DST} -port=${port} -freezecheck -BEpath=${SERVER_PROFILE}/battleye -profiles=${SERVER_PROFILE} -nologs" @@ -62,10 +63,10 @@ loadconfig(){ exit 1 fi # Handle the initial server configuration file - if [ ! -f ${SERVER_CFG_DST} ] + if [ ! -f ${SERVER_CFG_SAVE} ] then echo "Creating initial server configuration file" - cp "${SERVER_CFG_SRC}" "${SERVER_CFG_DST}" + cp "${SERVER_CFG_SRC}" "${SERVER_CFG_SAVE}" fi # battleye config and rconpassword setup # The server creates a new file from this file, which it then uses. @@ -411,6 +412,9 @@ start(){ # actual status with those echo ${mod_command_line} > /tmp/mod_command_line echo ${parameters} > /tmp/parameters + # Add the steam port from the environment + cp -a "${SERVER_CFG_SAVE}" "${SERVER_CFG_DST}" + sed -e "s,^steamQueryPort.*,steamQueryPort = ${STEAM_PORT};," -i "${SERVER_CFG_DST}" ./DayZServer "${mod_command_line}" ${parameters} EXIT_CODE=$? printf "\n[ ${yellow}DayZ${default} ] Server exited. Exit code: ${EXIT_CODE}\n" @@ -446,20 +450,20 @@ force(){ # Handle any changes in the server config file by allowing them to be merged after viewing a diff. config(){ - if ! diff -q "${SERVER_CFG_DST}" "${SERVER_CFG_SRC}" + if ! diff -q "${SERVER_CFG_SAVE}" "${SERVER_CFG_SRC}" then echo "=========================================================================" - diff -Nau --color "${SERVER_CFG_DST}" "${SERVER_CFG_SRC}" | more + diff -Nau --color "${SERVER_CFG_SAVE}" "${SERVER_CFG_SRC}" | more echo "=========================================================================" if prompt_yn "The new server configuration file differs from what's installed. Use it?" then echo "Updating the server configuration file" - cp "${SERVER_CFG_SRC}" "${SERVER_CFG_DST}" + cp "${SERVER_CFG_SRC}" "${SERVER_CFG_SAVE}" else echo "NOT updating the server configuration file" fi else - echo "No differences found between ${SERVER_CFG_SRC} and ${SERVER_CFG_DST}" + echo "No differences found between ${SERVER_CFG_SRC} and ${SERVER_CFG_SAVE}" fi } @@ -540,9 +544,9 @@ activelist(){ get_map_name(){ MAP="none" # Map name - if [[ -f ${SERVER_CFG_DST} ]] + if [[ -f ${SERVER_CFG_SAVE} ]] then - MAP=$(grep -E "template=" ${SERVER_CFG_DST} | grep -vE "^//" | cut -d= -f2 | cut -d\; -f1 | tr -d '"') + MAP=$(grep -E "template=" ${SERVER_CFG_SAVE} | grep -vE "^//" | cut -d= -f2 | cut -d\; -f1 | tr -d '"') fi echo ${MAP} }