Pārlūkot izejas kodu

Merge pull request #1016 from hurdad/master

adding Battlefield: 1942 + Unreal Tournament 3
Alexander Hurd 9 gadi atpakaļ
vecāks
revīzija
64beca75c7

+ 141 - 0
Battlefield1942/bf1942server

@@ -0,0 +1,141 @@
+#!/bin/bash
+# Battlefield: 1942
+# 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
+ip="0.0.0.0"
+
+fn_parms(){
+parms=" +hostServer 1 +dedicated 1"
+}
+
+#### 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="bf1942-server"
+gamename="Battlefield: 1942"
+engine="refractor"
+
+# 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}"
+executabledir="${systemdir}"
+executable="./start.sh"
+servercfg="serversettings.con"
+servercfgdir="${systemdir}/mods/bf1942/settings"
+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

+ 155 - 0
UnrealTournament3/ut3server

@@ -0,0 +1,155 @@
+#!/bin/bash
+# Unreal Tournament 3
+# 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
+ip="0.0.0.0"
+port="7777"
+queryport="25300"
+defaultmap="VCTF-Suspense"
+game="UTGameContent.UTVehicleCTFGame_Content"
+mutators="" #"UTGame.UTMutator_Instagib,UTGame.UTMutator_LowGrav"
+isdedicated="true"
+islanmatch="false"
+usesstats="false"
+shouldadvertise="true"
+pureserver="1"
+allowjoininprogress="true"
+maxplayers="32"
+
+#list of game types and mutators : http://wiki.unrealadmin.org/FAQ:UT3
+fn_parms(){
+parms="server ${defaultmap}?Game=${game}?bIsDedicated=${isdedicated}?bIsLanMatch=${islanmatch}?bUsesStats=${usesstats}?bShouldAdvertise=${shouldadvertise}?PureServer=${pureserver}?bAllowJoinInProgress=${allowjoininprogress}?MaxPlayers=${maxplayers}?Mutator=${mutators} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}"
+}
+
+# Server Details
+servicename="ut3-server"
+gamename="Unreal Tournament 3"
+engine="unreal3"
+
+# 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}"
+executabledir="${systemdir}/Binaries"
+executable="./ut3"
+servercfg="UTGame.ini"
+servercfgdir="${systemdir}/UTGame/Config"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+backupdir="${rootdir}/backups"
+
+# Logging
+logdays="7"
+gamelogdir="${rootdir}/log/server"
+scriptlogdir="${rootdir}/log/script"
+consolelogdir="${rootdir}/log/console"
+consolelogging="on"
+
+gamelog="${gamelogdir}/${servicename}-game.log"
+scriptlog="${scriptlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+emaillog="${scriptlogdir}/${servicename}-email.log"
+
+gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%d-%m-%Y-%H-%M-%S').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"
+
+# Github Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="GameServerManagers"
+githubrepo="LinuxGSM"
+githubbranch="master"
+
+##### 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
+

+ 3 - 0
lgsm/functions/check_deps.sh

@@ -176,6 +176,9 @@ if [ -n "$(command -v dpkg-query)" ]; then
 	# Brainbread 2 and Don't Starve Together
 	elif [ "${gamename}" == "Brainbread 2" ]||[ "${gamename}" == "Don't Starve Together" ]; then
 		array_deps_required+=( libcurl4-gnutls-dev:i386 )
+	# Battlefield: 1942 requies ncurses
+	elif [ "${gamename}" == "Battlefield: 1942" ]; then
+		array_deps_required+=( libncurses5:i386 )
 	# Project Zomboid and Minecraft
 	elif [ "${engine}" ==  "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then
 		array_deps_required+=( default-jdk )

+ 1 - 1
lgsm/functions/command_install.sh

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

+ 6 - 0
lgsm/functions/info_glibc.sh

@@ -77,6 +77,9 @@ elif [ "${engine}" == "unreal" ]; then
 elif [ "${engine}" == "unreal2" ]; then
 	glibcrequired="2.4"
 	glibcfix="no"
+elif [ "${engine}" == "unreal3" ]; then
+	glibcrequired="2.3.2"
+	glibcfix="no"
 elif [ "${engine}" == "unreal4" ]; then
 	glibcrequired="2.14"
 	glibcfix="no"
@@ -92,6 +95,9 @@ elif [ "${gamename}" == "Mumble" ]; then
 elif [ "${engine}" == "idtech3" ]; then
 	glibcrequired="2.0"
 	glibcfix="no"
+elif [ "${engine}" == "refractor" ]; then
+	glibcrequired="2.0"
+	glibcfix="no"
 else
 	glibcrequired="UNKNOWN"
 	glibcfix="no"

+ 29 - 0
lgsm/functions/install_config.sh

@@ -165,6 +165,33 @@ fn_unreal2config(){
 	echo ""
 }
 
+fn_ut3config(){
+	echo ""
+	echo "Configuring ${gamename} Server"
+	echo "================================="
+	sleep 1
+	echo "setting ServerName to 'LinuxGSM UT3 Server'."
+	fn_script_log_info "setting ServerName to 'LinuxGSM UT3 Server'."
+	sleep 1
+	sed -i 's/ServerName=/ServerName=LinuxGSM UT3 Server/g' "${servercfgdir}/DefaultGame.ini"
+	echo "setting WebAdmin password to admin."
+	fn_script_log_info "setting WebAdmin password to admin."
+	echo '[Engine.AccessControl]' >> "${servercfgdir}/DefaultGame.ini"
+	echo 'AdminPassword=admin' >> "${servercfgdir}/DefaultGame.ini"
+	sleep 1
+	echo "enabling WebAdmin."
+	fn_script_log_info "enabling WebAdmin."
+	sed -i 's/bEnabled=false/bEnabled=True/g' "${servercfgdir}/DefaultWeb.ini"
+	if [ "${gamename}" == "Unreal Tournament 3" ]; then
+		sleep 1
+		echo "setting WebAdmin port to 8081."
+		fn_script_log_info "setting WebAdmin port to 8081."
+		sed -i 's/ListenPort=80/ListenPort=8081/g' "${servercfgdir}/DefaultWeb.ini"
+	fi
+	sleep 1
+	echo ""
+}
+
 fn_unrealtournament(){
 	# allow user to input server name and password
 	if [ -z "${autoinstall}" ]; then
@@ -425,6 +452,8 @@ elif [ "${gamename}" == "Unreal Tournament" ]; then
 	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 3" ]; then
+	fn_ut3config
 elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
 	fn_unreal2config
 elif [ "${gamename}" == "Unreal Tournament 99" ]; then

+ 4 - 0
lgsm/functions/install_server_files.sh

@@ -13,6 +13,10 @@ 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"
 	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"
+	elif [ "${gamename}" == "Unreal Tournament 3" ]; then
+		fileurl="https://s3.amazonaws.com/linuxgsm/UT3-linux-server-2.1.tar.gz"; filedir="${lgsmdir}/tmp"; filename="UT3-linux-server-2.1.tar.gz";  executecmd="noexecute" run="norun"; force="noforce"; md5="6c22fcef9e2e03ed154df97569af540c"
+	elif [ "${gamename}" == "Battlefield: 1942" ]; then
+		fileurl="https://s3.amazonaws.com/linuxgsm/bf1942_lnxded-1.61-hacked-to-1.612.full.tar.gz"; filedir="${lgsmdir}/tmp"; filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.gz";  executecmd="noexecute" run="norun"; force="noforce"; md5="7e9d2538a62b228f2de7176b44659aa9"
 	elif [ "${gamename}" == "Enemy Territory" ]; then
 		fileurl="https://s3.amazonaws.com/linuxgsm/enemy-territory.260b.tar.gz"; filedir="${lgsmdir}/tmp"; filename="enemy-territory.260b.tar.gz";  executecmd="noexecute" run="norun"; force="noforce"; md5="ded32053e470fe15d9403ec4a0ab7e89"
 	elif [ "${gamename}" == "Unreal Tournament" ]; then