Browse Source

Merge pull request #1010 from hurdad/master

adding Unreal Tournament (Alpha)
Daniel Gibbs 9 years ago
parent
commit
fb42ee4cb5

+ 3 - 0
UnrealTournament/cfg/Engine.ini

@@ -0,0 +1,3 @@
+[/Script/UnrealTournament.UTGameEngine]
+bFirstRun=False
+RconPassword="<rconpassword>"

+ 4 - 0
UnrealTournament/cfg/Game.ini

@@ -0,0 +1,4 @@
+[/Script/UnrealTournament.UTGameState]
+ServerName="<hostname>"
+ServerMOTD=<UT.Font.NormalText.Huge>WELCOME</>\n\n<UT.Font.NormalText.Medium>Headshots for everyone.</>
+ServerDescription=This is my server, have fun

+ 147 - 0
UnrealTournament/utserver

@@ -0,0 +1,147 @@
+#!/bin/bash
+# Unreal Tournament
+# Server Management Script
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+if [ -f ".dev-debug" ]; then
+	exec 5>dev-debug.log
+	BASH_XTRACEFD="5"
+	set -x
+fi
+
+version="210516"
+
+#### Variables ####
+
+# Notification Alerts
+# (on|off)
+
+# Email
+emailalert="off"
+email="email@example.com"
+
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+
+# Start Variables
+defaultmap="DM-Underland"
+gametype="DM"
+#defaultmap="CTF-Face"
+#gametype="CTF"
+timelimit="10"
+ip="0.0.0.0"
+port="7777"
+
+fn_parms(){
+parms="UnrealTournament ${defaultmap}?Game=${gametype}?TimeLimit=${timelimit} -port=${port}"
+}
+
+#### Advanced Variables ####
+
+# Github Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="dgibbs64"
+githubrepo="linuxgsm"
+githubbranch="master"
+
+# Server Details
+servicename="ut-server"
+gamename="Unreal Tournament"
+engine="unreal4"
+
+# Directories
+rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
+libdir="${lgsmdir}/lib"
+filesdir="${rootdir}/serverfiles"
+systemdir="${filesdir}/LinuxServer"
+executabledir="${systemdir}/Engine/Binaries/Linux"
+executable="./UE4Server-Linux-Shipping"
+servercfg="Game.ini"
+servercfgdir="${systemdir}/UnrealTournament/Saved/Config/LinuxServer"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+backupdir="${rootdir}/backups"
+
+# Logging
+logdays="7"
+gamelogdir="${filesdir}/Logs"
+scriptlogdir="${rootdir}/log/script"
+consolelogdir="${rootdir}/log/console"
+consolelogging="on"
+
+scriptlog="${scriptlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+emaillog="${scriptlogdir}/${servicename}-email.log"
+
+scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
+
+##### Script #####
+# Do not edit
+
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
+	if [ ! -d "${filedir}" ]; then
+		mkdir -p "${filedir}"
+	fi
+	echo -e "    fetching ${filename}...\c"
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+		if [ $? -ne 0 ]; then
+			echo -e "\e[0;31mFAIL\e[0m\n"
+			echo "${curlfetch}"
+			echo -e "${githuburl}\n"
+			exit 1
+		else
+			echo -e "\e[0;32mOK\e[0m"
+		fi
+	else
+		echo -e "\e[0;31mFAIL\e[0m\n"
+		echo "Curl is not installed!"
+		echo -e ""
+		exit 1
+	fi
+	chmod +x "${filedir}/${filename}"
+fi
+source "${filedir}/${filename}"
+}
+
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_functions.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_dl.sh
+core_functions.sh
+
+getopt=$1
+core_getopt.sh

+ 6 - 0
lgsm/functions/check_deps.sh

@@ -188,6 +188,9 @@ if [ -n "$(command -v dpkg-query)" ]; then
 		else
 		else
 			array_deps_required+=( libsdl1.2debian bzip2 )
 			array_deps_required+=( libsdl1.2debian bzip2 )
 		fi
 		fi
+	# Unreal Tournament
+	elif [ "${gamename}" == "Unreal Tournament" ]; then
+		array_deps_required+=( unzip )
 	fi
 	fi
 	fn_deps_email
 	fn_deps_email
 	fn_check_loop
 	fn_check_loop
@@ -243,6 +246,9 @@ elif [ -n "$(command -v yum)" ]; then
 		else
 		else
 			array_deps_required+=( SDL.i686 bzip2 )
 			array_deps_required+=( SDL.i686 bzip2 )
 		fi
 		fi
+	# Unreal Tournament
+	elif [ "${gamename}" == "Unreal Tournament" ]; then
+		array_deps_required+=( unzip )
 	fi
 	fi
 	fn_deps_email
 	fn_deps_email
 	fn_check_loop
 	fn_check_loop

+ 1 - 1
lgsm/functions/command_install.sh

@@ -18,7 +18,7 @@ check_deps.sh
 if [ "${gamename}" == "Unreal Tournament 2004" ]; then
 if [ "${gamename}" == "Unreal Tournament 2004" ]; then
 	install_server_files.sh
 	install_server_files.sh
 	install_ut2k4_key.sh
 	install_ut2k4_key.sh
-elif [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]; then
+elif [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]; then
 	installer=1
 	installer=1
 	install_server_files.sh
 	install_server_files.sh
 elif [ -n "${appid}" ]; then
 elif [ -n "${appid}" ]; then

+ 3 - 1
lgsm/functions/core_dl.sh

@@ -44,7 +44,7 @@ fn_dl_md5(){
 	fi
 	fi
 }
 }
 
 
-# Extracts bzip2 or gzip files
+# Extracts bzip2 or gzip or zip files
 # Extracts can be defined in code like so:
 # Extracts can be defined in code like so:
 # fn_dl_extract "${filedir}" "${filename}" "${extractdir}"
 # fn_dl_extract "${filedir}" "${filename}" "${extractdir}"
 # fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles"
 # fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles"
@@ -61,6 +61,8 @@ fn_dl_extract(){
 		tarcmd=$(tar -zxf "${filedir}/${filename}" -C "${extractdir}")
 		tarcmd=$(tar -zxf "${filedir}/${filename}" -C "${extractdir}")
 	elif [ "${mime}" == "application/x-bzip2" ]; then
 	elif [ "${mime}" == "application/x-bzip2" ]; then
 		tarcmd=$(tar -jxf "${filedir}/${filename}" -C "${extractdir}")
 		tarcmd=$(tar -jxf "${filedir}/${filename}" -C "${extractdir}")
+	elif [ "${mime}" == "application/zip" ]; then
+		tarcmd=$(unzip -d "${extractdir}" "${filedir}/${filename}")
 	fi
 	fi
 	local exitcode=$?
 	local exitcode=$?
 	if [ ${exitcode} -ne 0 ]; then
 	if [ ${exitcode} -ne 0 ]; then

+ 4 - 0
lgsm/functions/core_functions.sh

@@ -322,6 +322,10 @@ functionfile="${FUNCNAME}"
 fn_fetch_function
 fn_fetch_function
 }
 }
 
 
+fix_ut.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
 
 
 # Info
 # Info
 
 

+ 6 - 0
lgsm/functions/fix.sh

@@ -72,5 +72,11 @@ if [ "${function_selfname}" == "command_install.sh" ]; then
 		echo "================================="
 		echo "================================="
 		sleep 1
 		sleep 1
 		fix_ut99.sh
 		fix_ut99.sh
+	elif [ "${gamename}" == "Unreal Tournament" ]; then
+		echo ""
+		echo "Applying ${gamename} Server Fixes"
+		echo "================================="
+		sleep 1
+		fix_ut.sh
 	fi
 	fi
 fi
 fi

+ 14 - 0
lgsm/functions/fix_ut.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+# LGSM fix_ut.sh function
+# Author: Alexander Hurd
+# Website: https://gameservermanagers.com
+# Description: Resolves various issues with Unreal Tournament.
+
+local commandname="FIX"
+local commandaction="Fix"
+local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+#Set Binary Executable
+echo "chmod +x ${executabledir}/${executable}"
+chmod +x "${executabledir}/${executable}"
+sleep 1

+ 32 - 1
lgsm/functions/install_config.sh

@@ -36,7 +36,7 @@ fn_userinputconfig(){
 	fn_script_log_info "changing rconpassword."
 	fn_script_log_info "changing rconpassword."
 	sed -i "s/\"<rconpassword>\"/\"${rconpass}\"/g" "${servercfgfullpath}"
 	sed -i "s/\"<rconpassword>\"/\"${rconpass}\"/g" "${servercfgfullpath}"
 	sleep 1
 	sleep 1
-	}
+}
 
 
 fn_arma3config(){
 fn_arma3config(){
 	fn_defaultconfig
 	fn_defaultconfig
@@ -165,6 +165,30 @@ fn_unreal2config(){
 	echo ""
 	echo ""
 }
 }
 
 
+fn_unrealtournament(){
+	# allow user to input server name and password
+	if [ -z "${autoinstall}" ]; then
+		echo ""
+		echo "Configuring ${gamename} Server"
+		echo "================================="
+		sleep 1
+		read -p "Enter server name: " servername
+		read -p "Enter rcon password: " rconpass
+	else
+		servername="${servicename}"
+		rconpass="rconpassword"
+	fi
+	echo "changing hostname."
+	fn_script_log_info "changing hostname."
+	sed -i "s/\"<hostname>\"/\"${servername}\"/g" "${servercfgdir}/Game.ini"
+	sleep 1
+	echo "changing rconpassword."
+	fn_script_log_info "changing rconpassword."
+	sed -i "s/\"<rconpassword>\"/\"${rconpass}\"/g" "${servercfgdir}/Engine.ini"
+	sleep 1
+
+}
+
 echo ""
 echo ""
 if [ "${gamename}" != "Hurtworld" ]; then
 if [ "${gamename}" != "Hurtworld" ]; then
 echo "Creating Configs"
 echo "Creating Configs"
@@ -382,6 +406,13 @@ elif [ "${gamename}" == "Terraria" ]; then
 	wget -N /dev/null ${githuburl}/Terraria/cfg/lgsm-default.txt 2>&1 | grep -F HTTP | cut -c45- | uniq
 	wget -N /dev/null ${githuburl}/Terraria/cfg/lgsm-default.txt 2>&1 | grep -F HTTP | cut -c45- | uniq
 	sleep 1
 	sleep 1
 	fn_defaultconfig
 	fn_defaultconfig
+elif [ "${gamename}" == "Unreal Tournament" ]; then
+	echo -e "downloading Engine.ini...\c"
+	wget -N /dev/null ${githuburl}/UnrealTournament/cfg/Engine.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	echo -e "downloading Game.ini...\c"
+	wget -N /dev/null ${githuburl}/UnrealTournament/cfg/Game.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_unrealtournament
 elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
 elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
 	fn_unreal2config
 	fn_unreal2config
 elif [ "${gamename}" == "Unreal Tournament 99" ]; then
 elif [ "${gamename}" == "Unreal Tournament 99" ]; then

+ 2 - 0
lgsm/functions/install_server_files.sh

@@ -13,6 +13,8 @@ fn_install_server_files(){
 		fileurl="https://gameservermanagers.com/files/UnrealTournament99/ut99-server-451-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut99-server-451-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd"
 		fileurl="https://gameservermanagers.com/files/UnrealTournament99/ut99-server-451-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut99-server-451-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd"
 	elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
 	elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
 		fileurl="https://gameservermanagers.com/files/UnrealTournament2004/ut2004-server-3339-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut2004-server-3339-ultimate-linux.tar.bz2";  executecmd="noexecute" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54"
 		fileurl="https://gameservermanagers.com/files/UnrealTournament2004/ut2004-server-3339-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut2004-server-3339-ultimate-linux.tar.bz2";  executecmd="noexecute" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54"
+	elif [ "${gamename}" == "Unreal Tournament" ]; then
+		fileurl="https://s3.amazonaws.com/unrealtournament/UnrealTournament-Server-XAN-3045522-Linux.zip"; filedir="${lgsmdir}/tmp"; filename="UnrealTournament-Server-XAN-3045522-Linux.zip";  executecmd="noexecute" run="norun"; force="noforce"; md5="553fed5645a9fc623e92563049bf79f6"
 	elif [ "${gamename}" == "GoldenEye: Source" ]; then
 	elif [ "${gamename}" == "GoldenEye: Source" ]; then
 		fileurl="https://gameservermanagers.com/files/GoldenEyeSource/goldenEye_source_v4.2.4_server_2015_map_pack.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="goldenEye_source_v4.2.4_server_2015_map_pack.tar.bz2";  executecmd="noexecute" run="norun"; force="noforce"; md5="3148ac38acc3642b0d6d64f51f27de15"
 		fileurl="https://gameservermanagers.com/files/GoldenEyeSource/goldenEye_source_v4.2.4_server_2015_map_pack.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="goldenEye_source_v4.2.4_server_2015_map_pack.tar.bz2";  executecmd="noexecute" run="norun"; force="noforce"; md5="3148ac38acc3642b0d6d64f51f27de15"
 	fi
 	fi