From 54bf33264da3fcc55f9682a4ef23848fbee8705e Mon Sep 17 00:00:00 2001 From: Marcin Jakubowski Date: Mon, 20 Dec 2021 22:07:23 +0100 Subject: [PATCH] feat(newserver): DayZ (#3557) * feat(dayzserver): add base dayz support * feat(dayzserver): add game info support * fix(dayzserver): fix dayz mods if run in debug * feat(dayzserver): add install game config * fix(dayzserver): fix shortname in install_config * feat(dayzserver): download config from remote * fix(dayzserver): fix default server cfg file * fix(dayzserver): temporarily use default debug cmd * fix(dayzserver): fix DayZ info game ports * feat(dayzserver): add change port config location * refactor(dayzserver): cleaner reading of server variables * fix(dayzserver): fix DayZ debug parameters. * fix(dayzserver): add dayz to dependency files * fix(dayzserver): add gotify allerts to dayz config --- .../config-lgsm/dayzserver/_default.cfg | 202 ++++++++++++++++++ lgsm/data/almalinux-8.csv | 1 + lgsm/data/centos-7.csv | 1 + lgsm/data/centos-8.csv | 1 + lgsm/data/debian-10.csv | 1 + lgsm/data/debian-11.csv | 1 + lgsm/data/debian-9.csv | 1 + lgsm/data/rhel-7.csv | 1 + lgsm/data/rhel-8.csv | 1 + lgsm/data/rocky-8.csv | 1 + lgsm/data/serverlist.csv | 1 + lgsm/data/ubuntu-16.04.csv | 1 + lgsm/data/ubuntu-18.04.csv | 1 + lgsm/data/ubuntu-20.04.csv | 1 + lgsm/data/ubuntu-21.04.csv | 1 + lgsm/functions/info_game.sh | 30 +++ lgsm/functions/info_messages.sh | 14 +- lgsm/functions/install_config.sh | 8 + 18 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 lgsm/config-default/config-lgsm/dayzserver/_default.cfg diff --git a/lgsm/config-default/config-lgsm/dayzserver/_default.cfg b/lgsm/config-default/config-lgsm/dayzserver/_default.cfg new file mode 100644 index 000000000..45042cf07 --- /dev/null +++ b/lgsm/config-default/config-lgsm/dayzserver/_default.cfg @@ -0,0 +1,202 @@ +################################## +######## Default Settings ######## +################################## +# DO NOT EDIT, ANY CHANGES 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. + +#### Game Server Settings #### + +## SteamCMD Login | https://docs.linuxgsm.com/steamcmd#steamcmd-login +# steamuser="username" +# steampass='password' + +## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters +ip="0.0.0.0" +port="2302" + +## DayZ Modules +# Add mods with relative paths: +# mods/@cf +# To load the "Community framework for DayZ SA" module found in the +# directory serverfiles/mods/@cf. Load several mods as: +# mods="mods/@cf\;mods/@dayz-expansion\;mods/@deerisle" +mods="" + +## Server-side Mods +servermods="" + +## Path to BattlEye +# Leave empty for default +bepath="" + +## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +startparameters="-ip=${ip} -port=${port} -config=${servercfgfullpath} -mod=${mods} -servermod=${servermods} -bepath=${bepath} -limitFPS=60 -dologs -adminlog -freezeCheck" + +#### LinuxGSM Settings #### + +## LinuxGSM Stats +# Send useful stats to LinuxGSM developers. +# https://docs.linuxgsm.com/configuration/linuxgsm-stats +# (on|off) +stats="off" + +## 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" + +# 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="" + +# Gotify Alerts | https://docs.linuxgsm.com/alerts/gotify +gotifyalert="off" +gotifytoken="token" +gotifywebhook="webhook" + +# 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" +mailgunapiregion="us" +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" +pushoveruserkey="userkey" + +# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat +rocketchatalert="off" +rocketchatwebhook="webhook" +rocketchattoken="" + +# Slack Alerts | https://docs.linuxgsm.com/alerts/slack +slackalert="off" +slackwebhook="webhook" + +# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram +# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring". +# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help". +telegramapi="api.telegram.org" +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="5" + +## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors +ansi="on" + +#### Advanced Settings #### + +## Message Display Time | https://docs.linuxgsm.com/features/message-display-time +sleeptime="0.5" + +## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd +# Server appid +appid="1042420" +steamcmdforcewindows="no" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +betapassword="" +# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server +steammaster="false" + +## Stop Mode | https://docs.linuxgsm.com/features/stop-mode +# 1: tmux kill +# 2: CTRL+c +# 3: quit +# 4: quit 120s +# 5: stop +# 6: q +# 7: exit +# 8: 7 Days to Die +# 9: GoldSrc +# 10: Avorion +# 11: end +stopmode="2" + +## Query mode +# 1: session only +# 2: gamedig (gsquery fallback) +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="2" +querytype="protocol-valve" + +## Console type +consoleverbose="yes" +consoleinteract="no" + +## Game Server Details +# Do not edit +gamename="DayZ" +engine="enfusion" +glibc="2.27" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${serverfiles}" +executable="./DayZServer" +servercfgdir="${systemdir}/cfg" +servercfg="${selfname}.server.cfg" +servercfgdefault="server.cfg" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +lgsmlogdir="${logdir}/script" +consolelogdir="${logdir}/console" +lgsmlog="${lgsmlogdir}/${selfname}-script.log" +consolelog="${consolelogdir}/${selfname}-console.log" +alertlog="${lgsmlogdir}/${selfname}-alert.log" +postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log" + +## Logs Naming +lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" +consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log" diff --git a/lgsm/data/almalinux-8.csv b/lgsm/data/almalinux-8.csv index 4b9942c89..39c49c153 100644 --- a/lgsm/data/almalinux-8.csv +++ b/lgsm/data/almalinux-8.csv @@ -30,6 +30,7 @@ cscz csgo css,ncurses-libs.i686 dab +dayz dmc dod dodr diff --git a/lgsm/data/centos-7.csv b/lgsm/data/centos-7.csv index 97ea6298d..db84ecc18 100644 --- a/lgsm/data/centos-7.csv +++ b/lgsm/data/centos-7.csv @@ -30,6 +30,7 @@ cscz csgo css,ncurses-libs.i686 dab +dayz dmc dod dodr diff --git a/lgsm/data/centos-8.csv b/lgsm/data/centos-8.csv index 6218227d2..8084d9e0d 100644 --- a/lgsm/data/centos-8.csv +++ b/lgsm/data/centos-8.csv @@ -30,6 +30,7 @@ cscz csgo css,ncurses-libs.i686 dab +dayz dmc dod dodr diff --git a/lgsm/data/debian-10.csv b/lgsm/data/debian-10.csv index 634c58a1c..19d9b1828 100644 --- a/lgsm/data/debian-10.csv +++ b/lgsm/data/debian-10.csv @@ -30,6 +30,7 @@ cscz csgo css,libtinfo5:i386 dab +dayz dmc dod dodr diff --git a/lgsm/data/debian-11.csv b/lgsm/data/debian-11.csv index 8b49da2c5..926d6d255 100644 --- a/lgsm/data/debian-11.csv +++ b/lgsm/data/debian-11.csv @@ -30,6 +30,7 @@ cscz csgo css,libtinfo5:i386 dab +dayz dmc dod dodr diff --git a/lgsm/data/debian-9.csv b/lgsm/data/debian-9.csv index adda69a37..d6886018c 100644 --- a/lgsm/data/debian-9.csv +++ b/lgsm/data/debian-9.csv @@ -30,6 +30,7 @@ cscz csgo css,libtinfo5:i386 dab +dayz dmc dod dodr diff --git a/lgsm/data/rhel-7.csv b/lgsm/data/rhel-7.csv index 6b4f93372..5438404b1 100644 --- a/lgsm/data/rhel-7.csv +++ b/lgsm/data/rhel-7.csv @@ -30,6 +30,7 @@ cscz csgo css,ncurses-libs.i686 dab +dayz dmc dod dodr diff --git a/lgsm/data/rhel-8.csv b/lgsm/data/rhel-8.csv index 6b4f93372..5438404b1 100644 --- a/lgsm/data/rhel-8.csv +++ b/lgsm/data/rhel-8.csv @@ -30,6 +30,7 @@ cscz csgo css,ncurses-libs.i686 dab +dayz dmc dod dodr diff --git a/lgsm/data/rocky-8.csv b/lgsm/data/rocky-8.csv index 4b9942c89..39c49c153 100644 --- a/lgsm/data/rocky-8.csv +++ b/lgsm/data/rocky-8.csv @@ -30,6 +30,7 @@ cscz csgo css,ncurses-libs.i686 dab +dayz dmc dod dodr diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index 13ae66a0d..2ad567579 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -28,6 +28,7 @@ cscz,csczserver,Counter-Strike: Condition Zero csgo,csgoserver,Counter-Strike: Global Offensive css,cssserver,Counter-Strike: Source dab,dabserver,Double Action: Boogaloo +dayz,dayzserver,DayZ dmc,dmcserver,Deathmatch Classic dod,dodserver,Day of Defeat dodr,dodrserver,Day of Dragons diff --git a/lgsm/data/ubuntu-16.04.csv b/lgsm/data/ubuntu-16.04.csv index d56c0172a..7ff519720 100644 --- a/lgsm/data/ubuntu-16.04.csv +++ b/lgsm/data/ubuntu-16.04.csv @@ -30,6 +30,7 @@ cscz csgo css,libtinfo5:i386 dab +dayz dmc dod dodr diff --git a/lgsm/data/ubuntu-18.04.csv b/lgsm/data/ubuntu-18.04.csv index 634c58a1c..19d9b1828 100644 --- a/lgsm/data/ubuntu-18.04.csv +++ b/lgsm/data/ubuntu-18.04.csv @@ -30,6 +30,7 @@ cscz csgo css,libtinfo5:i386 dab +dayz dmc dod dodr diff --git a/lgsm/data/ubuntu-20.04.csv b/lgsm/data/ubuntu-20.04.csv index 5fdad7d61..a2fa9c28e 100644 --- a/lgsm/data/ubuntu-20.04.csv +++ b/lgsm/data/ubuntu-20.04.csv @@ -30,6 +30,7 @@ cscz csgo css,libtinfo5:i386 dab +dayz dmc dod dodr diff --git a/lgsm/data/ubuntu-21.04.csv b/lgsm/data/ubuntu-21.04.csv index 352d6d203..4274c4331 100644 --- a/lgsm/data/ubuntu-21.04.csv +++ b/lgsm/data/ubuntu-21.04.csv @@ -30,6 +30,7 @@ cscz csgo css,libtinfo5:i386 dab +dayz dmc dod dodr diff --git a/lgsm/functions/info_game.sh b/lgsm/functions/info_game.sh index 7d505a98a..70c8a3caa 100644 --- a/lgsm/functions/info_game.sh +++ b/lgsm/functions/info_game.sh @@ -462,6 +462,34 @@ fn_info_game_dodr(){ queryport=${queryport:-"27015"} } +fn_info_game_dayz(){ + # Config + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + adminpassword="${unavailable}" + serverpassword="${unavailable}" + maxplayers="${zero}" + else + servername=$(sed -nr 's/^hostname\s*=\s*"(.*)"\s*;/\1/p' "${servercfgfullpath}") + adminpassword=$(sed -nr 's/^passwordAdmin\s*=\s*"(.*)"\s*;/\1/p' "${servercfgfullpath}") + serverpassword=$(sed -nr 's/^password\s*=\s*"(.*)"\s*;/\1/p' "${servercfgfullpath}") + maxplayers=$(sed -nr 's/^maxPlayers\s*=\s*([0-9]+)\s*;/\1/p' "${servercfgfullpath}") + queryport=$(sed -nr 's/^steamQueryPort\s*=\s*([0-9]+)\s*;/\1/p' "${servercfgfullpath}") + + # Not Set + servername=${servername:-"NOT SET"} + adminpassword=${adminpassword:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET"} + maxplayers=${maxplayers:-"0"} + queryport=${queryport:-"27016"} + fi + + # Parameters + port=${port:-"2302"} + steammasterport=$((port+2)) + battleeyeport=$((port+4)) +} + fn_info_game_dst(){ # Config if [ ! -f "${clustercfgfullpath}" ]; then @@ -2245,6 +2273,8 @@ elif [ "${shortname}" == "codwaw" ]; then fn_info_game_codwaw elif [ "${shortname}" == "col" ]; then fn_info_game_col +elif [ "${shortname}" == "dayz" ]; then + fn_info_game_dayz elif [ "${shortname}" == "dodr" ]; then fn_info_game_dodr elif [ "${shortname}" == "dst" ]; then diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index 7b9b91309..a431bd54a 100755 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -669,7 +669,7 @@ fn_info_message_ports_edit(){ fi done # engines/games that require editing the start parameters. - local ports_edit_array=( "av" "col" "fctr" "goldsrc" "hw" "iw3.0" "ioquake3" "qfusion" "rust" "scpsl" "scpslsm" "sol" "spark" "source" "unreal4" "arma3" "unt" "vh" ) + local ports_edit_array=( "av" "col" "fctr" "goldsrc" "hw" "iw3.0" "ioquake3" "qfusion" "rust" "scpsl" "scpslsm" "sol" "spark" "source" "unreal4" "arma3" "dayz" "unt" "vh" ) for port_edit in "${ports_edit_array[@]}"; do if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then startparameterslocation="${configdirserver}" @@ -938,6 +938,16 @@ fn_info_message_csgo(){ } | column -s $'\t' -t } +fn_info_message_dayz(){ + { + fn_port "header" + fn_port "Game" port udp + fn_port "Query Steam" queryport udp + fn_port "Steam Master" steammasterport udp + fn_port "BattleEye" battleeyeport udp + } | column -s $'\t' -t +} + fn_info_message_dodr(){ { fn_port "header" @@ -1642,6 +1652,8 @@ fn_info_message_select_engine(){ fn_info_message_codwaw elif [ "${shortname}" == "col" ]; then fn_info_message_col + elif [ "${shortname}" == "dayz" ]; then + fn_info_message_dayz elif [ "${shortname}" == "dodr" ]; then fn_info_message_dodr elif [ "${shortname}" == "dst" ]; then diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index d8b496c38..a5fa7bb7e 100755 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -351,6 +351,14 @@ elif [ "${shortname}" == "css" ]; then fn_default_config_remote fn_set_config_vars fn_list_config_locations +elif [ "${shortname}" == "dayz" ]; then + gamedirname="DayZ" + fn_check_cfgdir + array_configs+=( server.cfg ) + fn_fetch_default_config + fn_default_config_remote + fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "dod" ]; then gamedirname="DayOfDefeat" array_configs+=( server.cfg )