Przeglądaj źródła

feat(newserver): Onset (#2682)

Co-authored-by: Daniel Gibbs <me@danielgibbs.co.uk>
Frédéric C 6 lat temu
rodzic
commit
8bc25e1c83

+ 163 - 0
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"

+ 1 - 0
lgsm/data/serverlist.csv

@@ -59,6 +59,7 @@ nmrih,nmrihserver,No More Room in Hell
 ns,nsserver,Natural Selection
 ns,nsserver,Natural Selection
 ns2,ns2server,Natural Selection 2
 ns2,ns2server,Natural Selection 2
 ns2c,ns2cserver,NS2: Combat
 ns2c,ns2cserver,NS2: Combat
+onset,onsetserver,Onset
 opfor,opforserver,Opposing Force
 opfor,opforserver,Opposing Force
 pc,pcserver,Project Cars
 pc,pcserver,Project Cars
 pstbs,pstbsserver,Post Scriptum: The Bloody Seventh
 pstbs,pstbsserver,Post Scriptum: The Bloody Seventh

+ 6 - 0
lgsm/functions/check_deps.sh

@@ -400,6 +400,9 @@ fn_deps_build_debian(){
 	# Medal of Honor: Allied Assault
 	# Medal of Honor: Allied Assault
 	elif [ "${shortname}" == "mohaa" ]; then
 	elif [ "${shortname}" == "mohaa" ]; then
 		array_deps_required+=( libstdc++5:i386 )
 		array_deps_required+=( libstdc++5:i386 )
+	# Onset
+	elif [ "${shortname}" == "onset" ]; then
+		array_deps_required+=( libmariadbclient-dev )
 	# Project Zomboid
 	# Project Zomboid
 	elif [ "${shortname}" == "pz" ]; then
 	elif [ "${shortname}" == "pz" ]; then
 		if java -version 2>&1 | grep "version"; then
 		if java -version 2>&1 | grep "version"; then
@@ -518,6 +521,9 @@ fn_deps_build_redhat(){
 		else
 		else
 			array_deps_required+=( java-1.8.0-openjdk rng-tools )
 			array_deps_required+=( java-1.8.0-openjdk rng-tools )
 		fi
 		fi
+		# Onset
+	elif [ "${shortname}" == "onset" ]; then
+		array_deps_required+=( mariadb-connector-c )
 	# GoldenEye: Source
 	# GoldenEye: Source
 	elif [ "${shortname}" == "ges" ]; then
 	elif [ "${shortname}" == "ges" ]; then
 		array_deps_required+=( zlib.i686 openldap.i686 )
 		array_deps_required+=( zlib.i686 openldap.i686 )

+ 5 - 0
lgsm/functions/core_functions.sh

@@ -346,6 +346,11 @@ functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 fn_fetch_function
 }
 }
 
 
+fix_onset.sh(){
+functionfile="${FUNCNAME[0]}"
+fn_fetch_function
+}
+
 fix_ro.sh(){
 fix_ro.sh(){
 functionfile="${FUNCNAME[0]}"
 functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 fn_fetch_function

+ 3 - 1
lgsm/functions/fix.sh

@@ -51,6 +51,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th
 		fix_ins.sh
 		fix_ins.sh
 	elif [ "${shortname}" == "nmrih" ]; then
 	elif [ "${shortname}" == "nmrih" ]; then
 		fix_nmrih.sh
 		fix_nmrih.sh
+	elif [ "${shortname}" == "onset" ]; then
+		fix_onset.sh
 	elif [ "${shortname}" == "rust" ]; then
 	elif [ "${shortname}" == "rust" ]; then
 		fix_rust.sh
 		fix_rust.sh
 	elif [ "${shortname}" == "rw" ]; then
 	elif [ "${shortname}" == "rw" ]; then
@@ -84,7 +86,7 @@ fi
 
 
 # Fixes that are run on install only.
 # Fixes that are run on install only.
 if [ "${function_selfname}" == "command_install.sh" ]; then
 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 ""
 			echo -e "Applying Post-Install Fixes"
 			echo -e "Applying Post-Install Fixes"
 			echo -e "================================="
 			echo -e "================================="

+ 20 - 0
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

+ 26 - 0
lgsm/functions/info_config.sh

@@ -415,6 +415,29 @@ fn_info_config_minecraft_bedrock(){
 	fi
 	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(){
 fn_info_config_mohaa(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 	if [ ! -f "${servercfgfullpath}" ]; then
 		rconpassword="${unavailable}"
 		rconpassword="${unavailable}"
@@ -1406,6 +1429,9 @@ elif [ "${shortname}" == "mc" ]; then
 # Minecraft Bedrock
 # Minecraft Bedrock
 elif [ "${shortname}" == "mcb" ]; then
 elif [ "${shortname}" == "mcb" ]; then
 	fn_info_config_minecraft_bedrock
 	fn_info_config_minecraft_bedrock
+# Onset
+elif [ "${shortname}" == "onset" ]; then
+	fn_info_config_onset
 # Post Scriptum: The Bloody Seventh
 # Post Scriptum: The Bloody Seventh
 elif [ "${shortname}" == "pstbs" ]; then
 elif [ "${shortname}" == "pstbs" ]; then
 	fn_info_config_pstbs
 	fn_info_config_pstbs

+ 13 - 0
lgsm/functions/info_messages.sh

@@ -821,6 +821,17 @@ fn_info_message_minecraft_bedrock(){
 	} | column -s $'\t' -t
 	} | 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(){
 fn_info_message_mohaa(){
 	echo -e "netstat -atunp | grep mohaa_lnxded"
 	echo -e "netstat -atunp | grep mohaa_lnxded"
 	echo -e ""
 	echo -e ""
@@ -1387,6 +1398,8 @@ fn_info_message_select_engine(){
 		fn_info_message_kf2
 		fn_info_message_kf2
 	elif [ "${shortname}" == "mcb" ]; then
 	elif [ "${shortname}" == "mcb" ]; then
 		fn_info_message_minecraft_bedrock
 		fn_info_message_minecraft_bedrock
+	elif [ "${shortname}" == "onset" ]; then
+		fn_info_message_onset
 	elif [ "${shortname}" == "pz" ]; then
 	elif [ "${shortname}" == "pz" ]; then
 		fn_info_message_projectzomboid
 		fn_info_message_projectzomboid
 	elif [ "${shortname}" == "pstbs" ]; then
 	elif [ "${shortname}" == "pstbs" ]; then