Răsfoiți Sursa

feat(newserver): Assetto Corsa (#2830)

Daniel Gibbs 6 ani în urmă
părinte
comite
f0729fc330

+ 169 - 0
lgsm/config-default/config-lgsm/acserver/_default.cfg

@@ -0,0 +1,169 @@
+##################################
+######## 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'
+
+## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters
+
+## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+fn_parms(){
+parms="-c ${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://termbin.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="302550"
+# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
+branch=""
+
+## 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: Teamspeak 3
+stopmode="2"
+
+## Query mode
+# 1: session only
+# 2: gamedig + gsquery
+# 3: gamedig
+# 4: gsquery
+# 5: tcp
+querymode="5"
+querytype=""
+
+## Game Server Details
+# Do not edit
+gamename="Assetto Corsa"
+engine="unity3d"
+glibc=""
+
+#### Directories ####
+# Edit with care
+
+## Game Server Directories
+systemdir="${serverfiles}"
+executabledir="${systemdir}"
+executable="./acServer"
+servercfgdir="${systemdir}/cfg"
+servercfg="${selfname}.cfg"
+servercfgdefault="server_cfg.ini"
+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

@@ -1,3 +1,4 @@
+ac,acserver,Assetto Corsa
 ahl,ahlserver,Action half-life
 ahl2,ahl2server,Action: Source
 ark,arkserver,ARK: Survival Evolved

+ 3 - 3
lgsm/functions/check_steamcmd.sh

@@ -125,13 +125,13 @@ fn_check_steamcmd_ark(){
 
 fn_check_steamcmd_clear(){
 # Will remove steamcmd dir if steamcmd package is installed.
-if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${steamcmddir}" ]; then
+if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${rootdir}/steamcmd" ]; then
 	rm -rf "${steamcmddir:?}"
 	exitcode=$?
 	if [ ${exitcode} -ne 0 ]; then
-		fn_script_log_fatal "Removing ${steamcmddir}"
+		fn_script_log_fatal "Removing ${rootdir}/steamcmd"
 	else
-		fn_script_log_pass "Removing ${steamcmddir}"
+		fn_script_log_pass "Removing ${rootdir}/steamcmd"
 	fi
 fi
 }

+ 3 - 0
lgsm/functions/command_validate.sh

@@ -39,6 +39,9 @@ fn_validate(){
 		else
 			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
 		fi
+	elif [ "${shortname}" == "ac" ]; then
+		${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit
+		local exitcode=$?
 	# All other servers.
 	elif [ -n "${branch}" ]; then
 		${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"

+ 29 - 1
lgsm/functions/info_config.sh

@@ -14,6 +14,31 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 # grep -v "foo" filter out lines that contain foo
 # cut -f1 -d "/" remove everything after /
 
+
+fn_info_config_assettocorsa(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		httpport="${zero}"
+		port="${zero}"
+		queryport="${zero}"
+		servername="${unavailable}"
+		adminpassword="${unavailable}"
+	else
+		httpport=$(grep "HTTP_PORT" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		port=$(grep "TCP_PORT" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		queryport="${port}"
+		servername=$(grep "NAME" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/NAME//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'| head -n 1)
+		adminpassword=$(grep "ADMIN_PASSWORD" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/ADMIN_PASSWORD//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+
+		# Not Set
+		httpport=${httpport:-"0"}
+		port=${port:-"0"}
+		queryport=${queryport:-"0"}
+		servername=${servername:-"NOT SET"}
+		adminpassword=${adminpassword:-"NOT SET"}
+
+	fi
+}
+
 fn_info_config_justcause2(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
@@ -1374,8 +1399,11 @@ fn_info_config_soldat(){
 	fi
 }
 
+# Assetto Corsa
+if [ "${shortname}" == "ac" ]; then
+	fn_info_config_assettocorsa
 # ARK: Survival Evolved
-if [ "${shortname}" == "ark" ]; then
+elif [ "${shortname}" == "ark" ]; then
 	fn_info_config_ark
 # Ballistic Overkill
 elif [ "${shortname}" == "bo" ]; then

+ 13 - 1
lgsm/functions/info_messages.sh

@@ -621,6 +621,16 @@ fn_info_logs(){
 
 # Engine/Game Specific details
 
+fn_info_message_assettocorsa(){
+	echo -e "netstat -atunp| grep acServer"
+	echo -e ""
+	{
+		echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
+		echo -e "> Game\tINBOUND\t${port}\tudp"
+		echo -e "> HTTP\tINBOUND\t${port}\tudp"
+	} | column -s $'\t' -t
+}
+
 fn_info_message_ark(){
 	echo -e "netstat -atunp | grep ShooterGame"
 	echo -e ""
@@ -1358,7 +1368,9 @@ fn_info_message_warfork(){
 
 fn_info_message_select_engine(){
 	# Display details depending on game or engine.
-	if [ "${shortname}" == "ark" ]; then
+	if [ "${shortname}" == "ac" ]; then
+		fn_info_message_assettocorsa
+	elif [ "${shortname}" == "ark" ]; then
 		fn_info_message_ark
 	elif [ "${shortname}" == "arma3" ]; then
 		fn_info_message_arma3

+ 6 - 0
lgsm/functions/install_config.sh

@@ -147,6 +147,12 @@ fn_set_dst_config_vars(){
 if [ "${shortname}" == "sdtd" ]; then
 	gamedirname="7DaysToDie"
 	fn_default_config_local
+elif [ "${shortname}" == "ac" ]; then
+	gamedirname="AssettoCorsa"
+	array_configs+=( server_cfg.ini )
+	fn_fetch_default_config
+	fn_default_config_remote
+	fn_set_config_vars
 elif [ "${shortname}" == "ahl" ]; then
 	gamedirname="ActionHalfLife"
 	array_configs+=( server.cfg )

+ 6 - 1
lgsm/functions/install_server_files.sh

@@ -111,6 +111,8 @@ fn_install_server_files_steamcmd(){
 					else
 							${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit
 					fi
+				elif [ "${shortname}" == "ac" ]; then
+					${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit
 				# All other servers.
 				else
 					if [ -n "${branch}" ]; then
@@ -130,6 +132,9 @@ fn_install_server_files_steamcmd(){
 						${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" validate +quit
 					fi
 					local exitcode=$?
+				elif [ "${shortname}" == "ac" ]; then
+					${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit
+					local exitcode=$?
 				# All other servers.
 				else
 					if [ -n "${branch}" ]; then
@@ -150,7 +155,7 @@ fn_install_server_files_steamcmd(){
 	# GoldSrc (appid 90) servers commonly fail to download all the server files required.
 	# Validating a few of times may reduce the chance of this issue.
 	if [ "${appid}" == "90" ]; then
-    fn_print_information_nl "GoldSrc servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue."
+		fn_print_information_nl "GoldSrc servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue."
 		counter="0"
 		while [ "${counter}" -le "4" ]; do
 			counter=$((counter+1))

+ 2 - 0
lgsm/functions/update_steamcmd.sh

@@ -27,6 +27,8 @@ fn_update_steamcmd_dl(){
 		else
 			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit | tee -a "${lgsmlog}"
 		fi
+	elif [ "${shortname}" == "ac" ]; then
+		${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit
 	# All other servers.
 	else
 		if [ -n "${branch}" ]; then