From 8bc25e1c836ef548176b8783d793807fff15fc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20C?= Date: Fri, 6 Mar 2020 18:54:51 -0500 Subject: [PATCH] feat(newserver): Onset (#2682) Co-authored-by: Daniel Gibbs --- .../config-lgsm/onsetserver/_default.cfg | 163 ++++++++++++++++++ lgsm/data/serverlist.csv | 1 + lgsm/functions/check_deps.sh | 6 + lgsm/functions/core_functions.sh | 5 + lgsm/functions/fix.sh | 4 +- lgsm/functions/fix_onset.sh | 20 +++ lgsm/functions/info_config.sh | 26 +++ lgsm/functions/info_messages.sh | 13 ++ 8 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 lgsm/config-default/config-lgsm/onsetserver/_default.cfg create mode 100644 lgsm/functions/fix_onset.sh diff --git a/lgsm/config-default/config-lgsm/onsetserver/_default.cfg b/lgsm/config-default/config-lgsm/onsetserver/_default.cfg new file mode 100644 index 000000000..8b4631616 --- /dev/null +++ b/lgsm/config-default/config-lgsm/onsetserver/_default.cfg @@ -0,0 +1,163 @@ +################################## +######## 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. + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ +parms="--config ${servercfgfullpath}" +} + +#### 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" +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" + +# 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) 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" + +## 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="1204170" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +# 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: Gold Source +# 10: Teamspeak 3 +stopmode="2" + +## Query mode +# 1: session only +# 2: gamedig + gsquery +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="1" +querytype="" + +## Game Server Details +# Do not edit +gamename="Onset" +engine="unreal4" +glibc="2.24" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${serverfiles}" +executable="./OnsetServer" +servercfg="server_config.json" +servercfgdefault="server_config.json" +servercfgdir="${serverfiles}" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${systemdir}/logs" +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/serverlist.csv b/lgsm/data/serverlist.csv index 5f4398d28..3cceb1f91 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -59,6 +59,7 @@ nmrih,nmrihserver,No More Room in Hell ns,nsserver,Natural Selection ns2,ns2server,Natural Selection 2 ns2c,ns2cserver,NS2: Combat +onset,onsetserver,Onset opfor,opforserver,Opposing Force pc,pcserver,Project Cars pstbs,pstbsserver,Post Scriptum: The Bloody Seventh diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index d4ddc8eed..c41ada102 100644 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -400,6 +400,9 @@ fn_deps_build_debian(){ # Medal of Honor: Allied Assault elif [ "${shortname}" == "mohaa" ]; then array_deps_required+=( libstdc++5:i386 ) + # Onset + elif [ "${shortname}" == "onset" ]; then + array_deps_required+=( libmariadbclient-dev ) # Project Zomboid elif [ "${shortname}" == "pz" ]; then if java -version 2>&1 | grep "version"; then @@ -518,6 +521,9 @@ fn_deps_build_redhat(){ else array_deps_required+=( java-1.8.0-openjdk rng-tools ) fi + # Onset + elif [ "${shortname}" == "onset" ]; then + array_deps_required+=( mariadb-connector-c ) # GoldenEye: Source elif [ "${shortname}" == "ges" ]; then array_deps_required+=( zlib.i686 openldap.i686 ) diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index ef8d21a0c..54d7ec6a2 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -346,6 +346,11 @@ functionfile="${FUNCNAME[0]}" fn_fetch_function } +fix_onset.sh(){ +functionfile="${FUNCNAME[0]}" +fn_fetch_function +} + fix_ro.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh index 7c1567eda..864e69f49 100644 --- a/lgsm/functions/fix.sh +++ b/lgsm/functions/fix.sh @@ -51,6 +51,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th fix_ins.sh elif [ "${shortname}" == "nmrih" ]; then fix_nmrih.sh + elif [ "${shortname}" == "onset" ]; then + fix_onset.sh elif [ "${shortname}" == "rust" ]; then fix_rust.sh elif [ "${shortname}" == "rw" ]; then @@ -84,7 +86,7 @@ fi # Fixes that are run on install only. if [ "${function_selfname}" == "command_install.sh" ]; then - if [ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then + if [ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]||[ "${shortname}" == "onset" ]; then echo -e "" echo -e "Applying Post-Install Fixes" echo -e "=================================" diff --git a/lgsm/functions/fix_onset.sh b/lgsm/functions/fix_onset.sh new file mode 100644 index 000000000..9fbeddff3 --- /dev/null +++ b/lgsm/functions/fix_onset.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# LinuxGSM fix_onset.sh function +# Author: Frédéric C. +# Website: https://linuxgsm.com +# Description: Resolves various issues with Onset + +local commandname="FIX" +local commandaction="Fix" +local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") + +export LD_LIBRARY_PATH="${serverfiles}:$LD_LIBRARY_PATH" + +# Fixes: Failed loading "mariadb": libmariadbclient.so.18: cannot open shared object file: No such file or directory +# Issue only occures on CentOS as libmariadbclient.so.18 is called libmariadb.so.3 on CentOS. +if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/libmariadbclient.so.18" ]&&[ -f "/usr/lib64/libmariadb.so.3" ]; then + fixname="libmariadbclient.so.18" + fn_fix_msg_start + ln -s "/usr/lib64/libmariadb.so.3" "${serverfiles}/libmariadbclient.so.18" + fn_fix_msg_end +fi diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 2ad78197a..cc1fcb840 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -415,6 +415,29 @@ fn_info_config_minecraft_bedrock(){ fi } +fn_info_config_onset(){ + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + maxplayers="${zero}" + port="${zero}" + httpport="${zero}" + queryport="${zero}" + else + servername=$(grep -v "servername_short" "${servercfgfullpath}" | grep "servername" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/servername//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' ) + maxplayers=$(grep "maxplayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') + port=$(grep "port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]') + httpport=$((port-2)) + queryport=$((port-1)) + + # Not Set + servername=${servername:-"NOT SET"} + maxplayers=${maxplayers:-"NOT SET"} + port=${port:-"NOT SET"} + httpport=${httpport:-"NOT SET"} + queryport=${queryport:-"NOT SET"} + fi +} + fn_info_config_mohaa(){ if [ ! -f "${servercfgfullpath}" ]; then rconpassword="${unavailable}" @@ -1406,6 +1429,9 @@ elif [ "${shortname}" == "mc" ]; then # Minecraft Bedrock elif [ "${shortname}" == "mcb" ]; then fn_info_config_minecraft_bedrock +# Onset +elif [ "${shortname}" == "onset" ]; then + fn_info_config_onset # Post Scriptum: The Bloody Seventh elif [ "${shortname}" == "pstbs" ]; then fn_info_config_pstbs diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index a8a1042df..9d22e44d3 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -821,6 +821,17 @@ fn_info_message_minecraft_bedrock(){ } | column -s $'\t' -t } +fn_info_message_onset(){ + echo -e "netstat -atunp | grep OnsetServer" + echo -e "" + { + echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" + echo -e "> Game\tINBOUND\t${port}\tudp" + echo -e "> Query\tINBOUND\t${queryport}\tudp" + echo -e "> HTTP\tINBOUND\t${httpport}\ttcp" + } | column -s $'\t' -t +} + fn_info_message_mohaa(){ echo -e "netstat -atunp | grep mohaa_lnxded" echo -e "" @@ -1387,6 +1398,8 @@ fn_info_message_select_engine(){ fn_info_message_kf2 elif [ "${shortname}" == "mcb" ]; then fn_info_message_minecraft_bedrock + elif [ "${shortname}" == "onset" ]; then + fn_info_message_onset elif [ "${shortname}" == "pz" ]; then fn_info_message_projectzomboid elif [ "${shortname}" == "pstbs" ]; then