diff --git a/UnrealTournament/cfg/Engine.ini b/UnrealTournament/cfg/Engine.ini new file mode 100644 index 000000000..177eaafdb --- /dev/null +++ b/UnrealTournament/cfg/Engine.ini @@ -0,0 +1,3 @@ +[/Script/UnrealTournament.UTGameEngine] +bFirstRun=False +RconPassword="" diff --git a/UnrealTournament/cfg/Game.ini b/UnrealTournament/cfg/Game.ini new file mode 100644 index 000000000..15a1c9159 --- /dev/null +++ b/UnrealTournament/cfg/Game.ini @@ -0,0 +1,4 @@ +[/Script/UnrealTournament.UTGameState] +ServerName="" +ServerMOTD=WELCOME\n\nHeadshots for everyone. +ServerDescription=This is my server, have fun diff --git a/UnrealTournament/utserver b/UnrealTournament/utserver new file mode 100644 index 000000000..ac27d2474 --- /dev/null +++ b/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 diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index 6ccde762c..e81d34c43 100644 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -188,6 +188,9 @@ if [ -n "$(command -v dpkg-query)" ]; then else array_deps_required+=( libsdl1.2debian bzip2 ) fi + # Unreal Tournament + elif [ "${gamename}" == "Unreal Tournament" ]; then + array_deps_required+=( unzip ) fi fn_deps_email fn_check_loop @@ -243,6 +246,9 @@ elif [ -n "$(command -v yum)" ]; then else array_deps_required+=( SDL.i686 bzip2 ) fi + # Unreal Tournament + elif [ "${gamename}" == "Unreal Tournament" ]; then + array_deps_required+=( unzip ) fi fn_deps_email fn_check_loop diff --git a/lgsm/functions/command_install.sh b/lgsm/functions/command_install.sh index ac66e96e4..8af67e12a 100644 --- a/lgsm/functions/command_install.sh +++ b/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}" == "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 install_server_files.sh elif [ -n "${appid}" ]; then diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index 52155dc49..0c1e0a76b 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -44,7 +44,7 @@ fn_dl_md5(){ fi } -# Extracts bzip2 or gzip files +# Extracts bzip2 or gzip or zip files # Extracts can be defined in code like so: # fn_dl_extract "${filedir}" "${filename}" "${extractdir}" # 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}") elif [ "${mime}" == "application/x-bzip2" ]; then tarcmd=$(tar -jxf "${filedir}/${filename}" -C "${extractdir}") + elif [ "${mime}" == "application/zip" ]; then + tarcmd=$(unzip -d "${extractdir}" "${filedir}/${filename}") fi local exitcode=$? if [ ${exitcode} -ne 0 ]; then diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index e1e6cbbc7..d178f6eb3 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -322,6 +322,10 @@ functionfile="${FUNCNAME}" fn_fetch_function } +fix_ut.sh(){ +functionfile="${FUNCNAME}" +fn_fetch_function +} # Info diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh index f31c010d7..0178b363c 100644 --- a/lgsm/functions/fix.sh +++ b/lgsm/functions/fix.sh @@ -72,5 +72,11 @@ if [ "${function_selfname}" == "command_install.sh" ]; then echo "=================================" sleep 1 fix_ut99.sh + elif [ "${gamename}" == "Unreal Tournament" ]; then + echo "" + echo "Applying ${gamename} Server Fixes" + echo "=================================" + sleep 1 + fix_ut.sh fi fi diff --git a/lgsm/functions/fix_ut.sh b/lgsm/functions/fix_ut.sh new file mode 100644 index 000000000..74233406f --- /dev/null +++ b/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 \ No newline at end of file diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index 90ebb2ff1..ecc264ea2 100644 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -36,7 +36,7 @@ fn_userinputconfig(){ fn_script_log_info "changing rconpassword." sed -i "s/\"\"/\"${rconpass}\"/g" "${servercfgfullpath}" sleep 1 - } +} fn_arma3config(){ fn_defaultconfig @@ -165,6 +165,30 @@ fn_unreal2config(){ 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/\"\"/\"${servername}\"/g" "${servercfgdir}/Game.ini" + sleep 1 + echo "changing rconpassword." + fn_script_log_info "changing rconpassword." + sed -i "s/\"\"/\"${rconpass}\"/g" "${servercfgdir}/Engine.ini" + sleep 1 + +} + echo "" if [ "${gamename}" != "Hurtworld" ]; then 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 sleep 1 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 fn_unreal2config elif [ "${gamename}" == "Unreal Tournament 99" ]; then diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index 8f05a01a8..fc6969749 100644 --- a/lgsm/functions/install_server_files.sh +++ b/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" 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" ]; 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 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