From 1fabc013562c1994f68b9b0d2567399798255454 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 17 Jun 2019 00:40:54 +0100 Subject: [PATCH] feat(newserver): Barotrauma (#2400) Co-authored-by: Yann Kraetzschmann --- .../config-lgsm/btserver/_default.cfg | 137 ++++++++++++++++++ lgsm/data/serverlist.csv | 1 + lgsm/functions/check_system_requirements.sh | 3 + lgsm/functions/command_monitor.sh | 2 +- lgsm/functions/fix_steamcmd.sh | 10 +- lgsm/functions/info_config.sh | 26 ++++ lgsm/functions/info_messages.sh | 13 ++ lgsm/functions/info_parms.sh | 8 + lgsm/functions/install_config.sh | 7 + lgsm/functions/query_gamedig.sh | 2 +- lgsm/functions/query_gsquery.py | 2 +- 11 files changed, 207 insertions(+), 4 deletions(-) create mode 100644 lgsm/config-default/config-lgsm/btserver/_default.cfg diff --git a/lgsm/config-default/config-lgsm/btserver/_default.cfg b/lgsm/config-default/config-lgsm/btserver/_default.cfg new file mode 100644 index 000000000..614269477 --- /dev/null +++ b/lgsm/config-default/config-lgsm/btserver/_default.cfg @@ -0,0 +1,137 @@ +################################## +######## Default Settings ######## +################################## +# DO NOT EDIT WILL BE OVERWRITTEN! +# Copy settings from here and use them in either +# common.cfg - applies settings to every instance +# [instance].cfg - applies settings to a specific instance + +#### Server Settings #### + +## SteamCMD Login | https://docs.linuxgsm.com/steamcmd#steamcmd-login +steamuser="username" +steampass='password' + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ +parms="" +} + +#### LinuxGSM Settings #### + +## Notification Alerts +# (on|off) + +# Display IP | https://docs.linuxgsm.com/alerts#display-ip +displayip="" + +# More info | https://docs.linuxgsm.com/alerts#more-info +postalert="off" +postdays="7" +posttarget="https://hastebin.com" + +# Discord Alerts | https://docs.linuxgsm.com/alerts/discord +discordalert="off" +discordwebhook="webhook" + +# Email Alerts | https://docs.linuxgsm.com/alerts/email +emailalert="off" +email="email@example.com" +emailfrom="" + +# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt +iftttalert="off" +ifttttoken="accesstoken" +iftttevent="linuxgsm_alert" + +# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun +mailgunalert="off" +mailguntoken="accesstoken" +mailgundomain="example.com" +mailgunemailfrom="alert@example.com" +mailgunemail="email@myemail.com" + +# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet +pushbulletalert="off" +pushbullettoken="accesstoken" +channeltag="" + +# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover +pushoveralert="off" +pushovertoken="accesstoken" + +# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram +# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring". +# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need +# any custom string in curl - simple ignore this parameter. +telegramalert="off" +telegramtoken="accesstoken" +telegramchatid="" +curlcustomstring="" + +## Updating | https://docs.linuxgsm.com/commands/update +updateonstart="off" + +## Backup | https://docs.linuxgsm.com/commands/backup +maxbackups="4" +maxbackupdays="30" +stoponbackup="on" + +## Logging | https://docs.linuxgsm.com/features/logging +consolelogging="on" +logdays="7" + +## Monitor | https://docs.linuxgsm.com/commands/monitor +# Query delay time +querydelay="1" + +#### LinuxGSM Advanced Settings #### + +# ANSI Colors +ansi="on" + +# Message Display Time +sleeptime="0.5" + +## SteamCMD Settings +# Server appid +appid="602960" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server +steammaster="true" + +## LinuxGSM Server Details +# Do not edit +gamename="Barotrauma" +engine="barotrauma" +glibc="2.17" + +#### Directories #### +# Edit with care + +## Server Specific Directories +systemdir="${serverfiles}" +executabledir="${systemdir}" +executable="./DedicatedServer" +servercfg="serversettings.xml" +servercfgdefault="serversettings.xml" +servercfgdir="${systemdir}" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backups" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${systemdir}/ServerLogs" +lgsmlogdir="${logdir}/script" +consolelogdir="${logdir}/console" +lgsmlog="${lgsmlogdir}/${servicename}-script.log" +consolelog="${consolelogdir}/${servicename}-console.log" +alertlog="${lgsmlogdir}/${servicename}-alert.log" +postdetailslog="${lgsmlogdir}/${servicename}-postdetails.log" + +## Logs Naming +lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" +consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log" diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index b9494bede..b230e225b 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -8,6 +8,7 @@ bmdm,bmdmserver,Black Mesa: Deathmatch bs,bsserver,Blade Symphony bb,bbserver,BrainBread bb2,bb2server,BrainBread 2 +bt,btserver,Barotrauma bt1944,bt1944server,Battalion 1944 cod,codserver,Call of Duty cod2,cod2server,Call of Duty 2 diff --git a/lgsm/functions/check_system_requirements.sh b/lgsm/functions/check_system_requirements.sh index bc2317f48..1493f6b85 100644 --- a/lgsm/functions/check_system_requirements.sh +++ b/lgsm/functions/check_system_requirements.sh @@ -15,6 +15,9 @@ info_distro.sh if [ "${shortname}" == "ark" ]; then ramrequirementmb="4000" ramrequirementgb="4" +elif [ "${shortname}" == "bt" ]; then + ramrequirementmb="1000" + ramrequirementgb="1" elif [ "${shortname}" == "mh" ]; then ramrequirementmb="4000" ramrequirementgb="4" diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index 772be28a9..49cfffbce 100644 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -133,7 +133,7 @@ fn_monitor_check_session(){ fn_monitor_query(){ fn_script_log_info "Querying port: query enabled" # Engines that work with query. - local allowed_engines_array=( avalanche2.0 avalanche3.0 goldsource idtech2 idtech3 idtech3_ql ioquake3 iw2.0 iw3.0 lwjgl2 madness quake refractor realvirtuality source spark starbound unity3d unreal unreal2 unreal4 wurm ) + local allowed_engines_array=( avalanche2.0 avalanche3.0 barotrauma goldsource idtech2 idtech3 idtech3_ql ioquake3 iw2.0 iw3.0 lwjgl2 madness quake refractor realvirtuality source spark starbound unity3d unreal unreal2 unreal4 wurm ) for allowed_engine in "${allowed_engines_array[@]}" do if [ "${allowed_engine}" == "${engine}" ]; then diff --git a/lgsm/functions/fix_steamcmd.sh b/lgsm/functions/fix_steamcmd.sh index a3f60e89c..eb1622978 100644 --- a/lgsm/functions/fix_steamcmd.sh +++ b/lgsm/functions/fix_steamcmd.sh @@ -17,7 +17,15 @@ if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then fn_fix_msg_end fi -if [ "${shortname}" == "ss3" ]; then +if [ "${shortname}" == "bt" ]; then + # Fixes: [S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed. + if [ ! -L "${executabledir}/lib64/steamclient.so" ]; then + fixname="steamclient.so x86_64" + fn_fix_msg_start + cp -s -v "${steamcmddir}/linux64/steamclient.so" "${executabledir}/lib64/steamclient.so" >> "${lgsmlog}" + fn_fix_msg_end + fi +elif [ "${shortname}" == "ss3" ]; then # Fixes: .steam/bin32/libsteam.so: cannot open shared object file: No such file or directory if [ ! -f "${HOME}/.steam/bin32/libsteam.so" ]; then fixname="libsteam.so" diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 14d77cf9f..275fb54f2 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -110,6 +110,29 @@ fn_info_config_ballistic_overkill(){ fi } +fn_info_config_barotrauma(){ + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + serverpassword="${unavailable}" + port="${zero}" + queryport="${zero}" + maxplayers="${unavailable}" + else + servername=$(grep -Po 'name="\K.*(?=")' "${servercfgfullpath}") # Assuming GNU grep is used + serverpassword=$(grep -Po 'password="\K.*(?=")' "${servercfgfullpath}") # Assuming GNU grep is used + port=$(grep " port=" "${servercfgfullpath}" | tr -cd '[:digit:]') + queryport=$(grep "queryport=" "${servercfgfullpath}" | tr -cd '[:digit:]') + maxplayers=$(grep "maxplayers=" "${servercfgfullpath}" | tr -cd '[:digit:]') + + # Not set + servername=${servername:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET"} + port=${port:-"0"} + queryport=${queryport:-"0"} + maxplayers=${maxplayers:-"0"} + fi +} + fn_info_config_battalion1944(){ if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" @@ -1195,6 +1218,9 @@ if [ "${shortname}" == "ark" ]; then # Ballistic Overkill elif [ "${shortname}" == "bo" ]; then fn_info_config_ballistic_overkill +# Barotrauma +elif [ "${shortname}" == "bt" ]; then + fn_info_config_barotrauma # Battalion 1944 elif [ "${shortname}" == "bt1944" ]; then fn_info_config_battalion1944 diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index d8f7abd63..270caaadd 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -1205,6 +1205,17 @@ fn_info_message_mordhau(){ } | column -s $'\t' -t } +fn_info_message_barotrauma(){ + echo "netstat -atunp | grep /./DedicatedSer" + echo -e "" + { + echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" + echo -e "> Game\tINBOUND\t${port}\tudp" + echo -e "> Query\tINBOUND\t$((port+1))\tudp" + } | column -s $'\t' -t +} + + fn_info_message_select_engine(){ # Display details depending on game or engine. if [ "${gamename}" == "7 Days To Die" ]; then @@ -1213,6 +1224,8 @@ fn_info_message_select_engine(){ fn_info_message_ark elif [ "${gamename}" == "Ballistic Overkill" ]; then fn_info_message_ballisticoverkill + elif [ "${gamename}" == "Barotrauma" ]; then + fn_info_message_barotrauma elif [ "${gamename}" == "Battalion 1944" ]; then fn_info_message_battalion1944 elif [ "${gamename}" == "Call of Duty" ]; then diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh index 7b080036d..f21924c92 100644 --- a/lgsm/functions/info_parms.sh +++ b/lgsm/functions/info_parms.sh @@ -22,6 +22,11 @@ fn_info_parms_ark(){ maxplayers=${maxplayers:-"0"} } +fn_info_parms_barotrauma(){ + port=${port:-"0"} + queryport=${queryport:-"0"} +} + fn_info_parms_realvirtuality(){ port=${port:-"0"} queryport=$((port + 1)) @@ -197,6 +202,9 @@ if [ "${shortname}" == "ark" ]; then # ARMA 3 elif [ "${shortname}" == "arma3" ]; then fn_info_parms_realvirtuality +# Barotrauma +elif [ "${shortname}" == "bt" ]; then + fn_info_parms_barotrauma # Call of Duty elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${engine}" == "iw2.0" ]||[ "${engine}" == "iw3.0" ]; then fn_info_parms_cod diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index b601da7fc..7edad6595 100644 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -173,6 +173,13 @@ elif [ "${gamename}" == "Base Defense" ]; then fn_fetch_default_config fn_default_config_remote fn_set_config_vars +elif [ "${gamename}" == "Barotrauma" ]; then + gamedirname="Barotrauma" + fn_check_cfgdir + array_configs+=( serversettings.xml ) + fn_fetch_default_config + fn_default_config_remote + fn_set_config_vars elif [ "${gamename}" == "Battalion 1944" ]; then gamedirname="Battalion1944" fn_check_cfgdir diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/functions/query_gamedig.sh index 2c6192030..56d55206f 100644 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/functions/query_gamedig.sh @@ -14,7 +14,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; local engine="unreal4" fi - local engine_query_array=( avalanche3.0 madness quakelive realvirtuality refractor source goldsource spark starbound unity3d unreal4 wurm ) + local engine_query_array=( avalanche3.0 barotrauma madness quakelive realvirtuality refractor source goldsource spark starbound unity3d unreal4 wurm ) for engine_query in "${engine_query_array[@]}" do if [ "${engine_query}" == "${engine}" ]; then diff --git a/lgsm/functions/query_gsquery.py b/lgsm/functions/query_gsquery.py index fe809be15..b02262382 100644 --- a/lgsm/functions/query_gsquery.py +++ b/lgsm/functions/query_gsquery.py @@ -17,7 +17,7 @@ class gsquery: self.server_response_timeout = 5 self.default_buffer_length = 1024 # - sourcequery=[ 'avalanche3.0','madness','quakelive','realvirtuality','refractor','source','goldsource','spark','starbound','unity3d', 'unreal4', 'wurm' ] + sourcequery=[ 'avalanche3.0','barotrauma''madness','quakelive','realvirtuality','refractor','source','goldsource','spark','starbound','unity3d', 'unreal4', 'wurm' ] idtech3query=['idtech3','iw3.0','ioquake3'] idtech2query=['idtech2','quake','iw2.0'] minecraftquery=['minecraft','lwjgl2']