diff --git a/CallOfDuty/codserver b/CallOfDuty/codserver new file mode 100755 index 000000000..ae19879e8 --- /dev/null +++ b/CallOfDuty/codserver @@ -0,0 +1,185 @@ +#!/bin/bash +# Project: Game Server Managers - LinuxGSM +# Author: Daniel Gibbs +# License: MIT License, Copyright (c) 2016 Daniel Gibbs +# Purpose: Call of Duty | Server Management Script +# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors +# Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki +# Website: https://gameservermanagers.com + +# Debugging +if [ -f ".dev-debug" ]; then + exec 5>dev-debug.log + BASH_XTRACEFD="5" + set -x +fi + +version="161030" + +########################## +######## Settings ######## +########################## + +#### Server Settings #### + +## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters +defaultmap="mp_neuville" +maxclients="20" +port="28960" +ip="0.0.0.0" + +## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters +fn_parms(){ +parms="+set sv_punkbuster 0 +set fs_basepath ${filesdir} +set dedicated 1 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxclients} +exec ${servercfg} +map ${defaultmap}" +} + +#### LinuxGSM Settings #### + +## Notification Alerts +# (on|off) +# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email +emailalert="off" +email="email@example.com" +emailfrom="" +# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet +pushbulletalert="off" +pushbullettoken="accesstoken" + +## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup +maxbackups="4" +maxbackupdays="30" +stoponbackup="on" + +## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging +consolelogging="on" +logdays="7" + +#### Advanced Variables #### + +## Github Branch Select +# Allows for the use of different function files +# from a different repo and/or branch. +githubuser="GameServerManagers" +githubrepo="LinuxGSM" +githubbranch="master" + +## LinuxGSM Server Details +# Do not edit +gamename="Call of Duty" +engine="idtech3" + +## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers +servicename="cod-server" + +#### Directories #### +# Edit with care + +## Work 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" +tmpdir="${lgsmdir}/tmp" +filesdir="${rootdir}/serverfiles" + +## Server Specific Directories +systemdir="${filesdir}" +executabledir="${filesdir}" +executable="./cod_lnxded" +servercfg="${servicename}.cfg" +servercfgdefault="server.cfg" +servercfgdir="${systemdir}/main" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${rootdir}/backups" + +## Logging Directories +gamelogdir="${filesdir}/Logs" +scriptlogdir="${rootdir}/log/script" +consolelogdir="${rootdir}/log/console" +scriptlog="${scriptlogdir}/${servicename}-script.log" +consolelog="${consolelogdir}/${servicename}-console.log" +emaillog="${scriptlogdir}/${servicename}-email.log" + +## Logs Naming +scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" +consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%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 +} + +# Prevent from running this script as root. +if [ "$(whoami)" = "root" ]; then + if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]||[ ! -f "${functionsdir}/core_exit.sh" ]; then + echo "[ FAIL ] Do NOT run this script as root!" + exit 1 + else + core_functions.sh + check_root.sh + fi +fi + +core_dl.sh +core_functions.sh +getopt=$1 +core_getopt.sh \ No newline at end of file diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index 3f0c0eb55..75b99a70a 100644 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -188,6 +188,9 @@ if [ -n "$(command -v dpkg-query)" ]; then # Battlefield: 1942 elif [ "${gamename}" == "Battlefield: 1942" ]; then array_deps_required+=( libncurses5:i386 ) + # Call of Duty + elif [ "${gamename}" == "Call of Duty" ]; then + array_deps_required+=( libstdc++5:i386 ) # Project Zomboid and Minecraft elif [ "${engine}" == "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then javaversion=$(java -version 2>&1 | grep "version") @@ -257,6 +260,9 @@ elif [ -n "$(command -v yum)" ]; then # Battlefield: 1942 elif [ "${gamename}" == "Battlefield: 1942" ]; then array_deps_required+=( ncurses-libs.i686 ) + # Call of Duty + elif [ "${gamename}" == "Call of Duty" ]; then + array_deps_required+=( compat-libstdc++-33.i686 ) # Project Zomboid and Minecraft elif [ "${engine}" == "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then javaversion=$(java -version 2>&1 | grep "version") diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index 5743e17b0..4f39fe2ef 100644 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -341,6 +341,15 @@ fn_details_avalanche(){ } | column -s $'\t' -t } +fn_details_cod(){ + echo -e "netstat -atunp | grep cod_lnxded" + echo -e "" + { + echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" + echo -e "> Game\tINBOUND\t${port}\tudp" + } | column -s $'\t' -t +} + fn_details_dontstarve(){ echo -e "netstat -atunp | grep dontstarve" echo -e "" @@ -698,6 +707,8 @@ fn_display_details() { fn_details_sdtd elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then fn_details_ark + elif [ "${gamename}" == "Call of Duty" ]; then + fn_details_cod elif [ "${gamename}" == "Hurtworld" ]; then fn_details_hurtworld elif [ "${gamename}" == "QuakeWorld" ]; then diff --git a/lgsm/functions/command_install.sh b/lgsm/functions/command_install.sh index d2feadb05..43dc9daf5 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}" == "Battlefield: 1942" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 3" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then +elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 3" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then installer=1 install_server_files.sh elif [ -n "${appid}" ]; then diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index d07f82d04..d629e3711 100644 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -622,7 +622,7 @@ case "${getopt}" in if [ "${gamename}" == "Mumble" ]; then fn_getopt_mumble -elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then +elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then fn_getopt_generic_no_update elif [ "${engine}" == "lwjgl2" ]; then fn_getopt_minecraft diff --git a/lgsm/functions/fix_glibc.sh b/lgsm/functions/fix_glibc.sh index 6408e3339..5abc18e9a 100644 --- a/lgsm/functions/fix_glibc.sh +++ b/lgsm/functions/fix_glibc.sh @@ -40,4 +40,4 @@ do fi done -export LD_LIBRARY_PATH=:"${libdir}" \ No newline at end of file +export LD_LIBRARY_PATH=:"${libdir}" diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 63ec0a85d..46e7445a6 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -66,6 +66,19 @@ fn_info_config_bf1942(){ fi } +fn_info_config_cod(){ + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + rconpassword="${unavailable}" + else + servername=$(grep "sv_hostname " "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname //g' | tr -d '=\";,:' | xargs) + rconpassword=$(grep "rconpassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set rconpassword //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + + # Not Set + servername=${servername:-"NOT SET"} + rconpassword=${rconpassword=:-"NOT SET"} + fi +} fn_info_config_dontstarve(){ if [ ! -f "${servercfgfullpath}" ]; then @@ -509,6 +522,9 @@ if [ "${engine}" == "avalanche" ]; then # Battlefield: 1942 elif [ "${gamename}" == "Battlefield: 1942" ]; then fn_info_config_bf1942 +# Call of Duty +elif [ "${gamename}" == "Call of Duty" ]; then + fn_info_config_cod # Dont Starve Together elif [ "${engine}" == "dontstarve" ]; then fn_info_config_dontstarve diff --git a/lgsm/functions/info_glibc.sh b/lgsm/functions/info_glibc.sh index 73ef6251d..d5564bbe8 100644 --- a/lgsm/functions/info_glibc.sh +++ b/lgsm/functions/info_glibc.sh @@ -14,6 +14,9 @@ elif [ "${gamename}" == "Blade Symphony" ]; then glibcfix="yes" elif [ "${gamename}" == "BrainBread 2" ]; then glibcrequired="2.17" +elif [ "${gamename}" == "Call of Duty" ]; then + glibcrequired="2.1" + glibcfix="yes" elif [ "${gamename}" == "Day of Infamy" ]; then glibcrequired="2.15" glibcfix="yes" diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index bdd7cb23e..543315458 100644 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -113,6 +113,12 @@ elif [ "${gamename}" == "Black Mesa: Deathmatch" ]; then fn_fetch_default_config fn_default_config_remote fn_set_config_vars +elif [ "${gamename}" == "Call of Duty" ]; then + gamedirname="CallOfDuty" + array_configs+=( server.cfg ) + fn_fetch_default_config + fn_default_config_remote + fn_set_config_vars elif [ "${gamename}" == "Codename CURE" ]; then gamedirname="CodenameCURE" array_configs+=( server.cfg ) diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index 00e8abc08..18268fc3f 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -23,6 +23,8 @@ fn_install_server_files(){ fileurl="http://files.gameservermanagers.com/UnrealTournament/UnrealTournament-Server-XAN-3045522-Linux.zip"; filedir="${tmpdir}"; filename="UnrealTournament-Server-XAN-3045522-Linux.zip"; executecmd="noexecute" run="norun"; force="noforce"; md5="553fed5645a9fc623e92563049bf79f6" elif [ "${gamename}" == "GoldenEye: Source" ]; then fileurl="http://files.gameservermanagers.com/GoldenEyeSource/GoldenEye_Source_v5.0.1_full_server_linux.tar.bz2"; filedir="${tmpdir}"; filename="GoldenEye_Source_v5.0.1_server_full_Linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="ea227a150300abe346e757380325f84c" + elif [ "${gamename}" == "Call of Duty" ]; then + fileurl="http://files.gameservermanagers.com/CallOfDuty/cod-lnxded-1.5b-full.tar.bz2"; filedir="${tmpdir}"; filename="cod-lnxded-1.5-large.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="19629895a4cf6fd8f6d1ee198b5304cd" elif [ "${gamename}" == "Quake 2" ]; then fileurl="http://files.gameservermanagers.com/Quake2/quake2-3.20-glibc-i386-full-linux2.0.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="quake2-3.20-glibc-i386-full-linux2.0.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="0b8c7e2d51f40b56b328c69e986e7c5f" elif [ "${gamename}" == "Quake 3: Arena" ]; then