Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions JediKnight2/jk2server
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
#!/bin/bash
# Project: Game Server Managers - LinuxGSM
# Author: Daniel Gibbs
# License: MIT License, Copyright (c) 2016 Daniel Gibbs
# Purpose: Jedi Knight II: Jedi Outcast | 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="161125"

##########################
######## Settings ########
##########################

#### Server Settings ####

## SteamCMD Login | https://github.com/GameServerManagers/LinuxGSM/wiki/SteamCMD#steamcmd-login
steamuser="username"
steampass="password"

## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
defaultmap="ffa_bespin"
ip="0.0.0.0"
port="27960"

## 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 com_hunkMegs 32 +set net_ip ${ip} +set net_port ${port} +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"
channeltag=""

## 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"

#### LinuxGSM Advanced Settings ####

## SteamCMD Settings
# Server appid
appid="6030"
# Steam App Branch Select
# Allows to opt into the various Steam app branches. Default branch is "".
# Example: "-beta latest_experimental"
branch=""

## Github Branch Select
# Allows for the use of different function files
# from a different repo and/or branch.
githubuser="nateberkopec"
githubrepo="LinuxGSM"
githubbranch="jk2"

## LinuxGSM Server Details
# Do not edit
gamename="Jedi Knight II: Jedi Outcast"
engine="idtech3"

## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
servicename="jk2ded"

#### 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}/baseq3"
executabledir="${filesdir}"
executable="./q3ded"
servercfg="${servicename}.cfg"
servercfgdefault="server.cfg"
servercfgdir="${systemdir}"
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
15 changes: 13 additions & 2 deletions lgsm/functions/command_details.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ fn_details_gameserver(){
if [ -n "${tickrate}" ]; then
echo -e "${blue}Tick rate:\t${default}${tickrate}"
fi

# Cluster (Don't Starve Together)
if [ -n "${cluster}" ]; then
echo -e "${blue}Cluster:\t${default}${cluster}"
fi

# Shard (Don't Starve Together)
if [ -n "${shard}" ]; then
echo -e "${blue}Shard:\t${default}${shard}"
Expand Down Expand Up @@ -485,6 +485,15 @@ fn_details_quakelive(){
} | column -s $'\t' -t
}

fn_details_jk2(){
echo -e "netstat -atunp | grep jk2ded"
echo -e ""
{
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Game\tINBOUND\t${port}\tudp"
} | column -s $'\t' -t
}

fn_details_wolfensteinenemyterritory(){
echo -e "netstat -atunp | grep etded"
echo -e ""
Expand Down Expand Up @@ -764,6 +773,8 @@ fn_display_details() {
fn_details_quake3
elif [ "${gamename}" == "Quake Live" ]; then
fn_details_quakelive
elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then
fn_details_jk2
elif [ "${gamename}" == "TeamSpeak 3" ]; then
fn_details_teamspeak3
elif [ "${gamename}" == "Mumble" ]; then
Expand Down
4 changes: 3 additions & 1 deletion lgsm/functions/command_validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ fn_validation(){

if [ "${engine}" == "goldsource" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ];
${unbuffer} ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
fi
Expand Down Expand Up @@ -54,4 +56,4 @@ if [ "${status}" != "0" ]; then
else
fn_validation
fi
core_exit.sh
core_exit.sh
6 changes: 6 additions & 0 deletions lgsm/functions/core_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}

fix_jk2.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}


fix_ro.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
Expand Down
2 changes: 1 addition & 1 deletion lgsm/functions/core_getopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ case "${getopt}" in

if [ "${gamename}" == "Mumble" ]; then
fn_getopt_mumble
elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_getopt_generic_no_update
elif [ "${engine}" == "lwjgl2" ]; then
fn_getopt_minecraft
Expand Down
2 changes: 2 additions & 0 deletions lgsm/functions/fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ if [ "${function_selfname}" != "command_install.sh" ]; then
fix_dst.sh
elif [ "${gamename}" == "GoldenEye: Source" ]; then
fix_ges.sh
elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then
fix_jk2.sh
elif [ "${gamename}" == "Insurgency" ]; then
fix_ins.sh
elif [ "${gamename}" == "Rust" ]; then
Expand Down
12 changes: 12 additions & 0 deletions lgsm/functions/fix_jk2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# LGSM fix_jk2.sh function
# Description: Resolves an issue with Jedi Knight 2.

local commandname="FIX"
local commandaction="Fix"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"

fixname="JK2 shared libraries"
fn_fix_msg_start
export LD_LIBRARY_PATH=${filesdir}:${filesdir}/lib:${LD_LIBRARY_PATH}
fn_fix_msg_end
31 changes: 27 additions & 4 deletions lgsm/functions/info_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn_info_config_dontstarve(){
gamemode=$(grep "game_mode" "${clustercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/game_mode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
tickrate=$(grep "tick_rate" "${clustercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
masterport=$(grep "master_port" "${clustercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')

ip=$(grep "bind_ip" "${clustercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bind_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
ipsetinconfig=1
ipinconfigvar="bind_ip"
Expand All @@ -136,7 +136,7 @@ fn_info_config_dontstarve(){
tickrate=${tickrate:-"0"}
masterport=${masterport:-"0"}
fi

if [ ! -f "${servercfgfullpath}" ]; then
port="${zero}"
steamauthenticationport="${zero}"
Expand All @@ -145,7 +145,7 @@ fn_info_config_dontstarve(){
port=$(grep "server_port" "${servercfgfullpath}" | grep "^server_port" | grep -v "#" | tr -cd '[:digit:]')
steamauthenticationport=$(grep "authentication_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
steammasterserverport=$(grep "master_server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')

# Not Set
port=${port:-"0"}
steamauthenticationport=${steamauthenticationport:-"0"}
Expand Down Expand Up @@ -275,6 +275,26 @@ fn_info_config_quakelive(){
fi
}

fn_info_config_jk2(){
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
servername="${unavailable}"
serverpassword="${unavailable}"
maxplayers="${zero}"
else
rconpassword=$(grep "zmq_rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set zmq_rcon_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
servername=$(grep "sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverpassword=$(grep "rconpassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set rconpassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "sv_maxclients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')

# Not Set
rconpassword=${rconpassword:-"NOT SET"}
servername=${servername:-"NOT SET"}
serverpassword=${serverpassword:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
fi
}

fn_info_config_wolfensteinenemyterritory(){
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
Expand Down Expand Up @@ -590,6 +610,9 @@ elif [ "${gamename}" == "Quake 3: Arena" ]; then
# Quake Live
elif [ "${gamename}" == "Quake Live" ]; then
fn_info_config_quakelive
# Jedi Outcast
elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then
fn_info_config_jk2
# Minecraft
elif [ "${engine}" == "lwjgl2" ]; then
fn_info_config_minecraft
Expand Down Expand Up @@ -627,4 +650,4 @@ elif [ "${gamename}" == "7 Days To Die" ]; then
fn_info_config_sdtd
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_info_config_wolfensteinenemyterritory
fi
fi
3 changes: 3 additions & 0 deletions lgsm/functions/info_glibc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ elif [ "${gamename}" == "Quake 3: Arena" ]; then
elif [ "${gamename}" == "Quake Live" ]; then
glibcrequired="2.15"
glibcfix="no"
elif [ "${gamename}" == "Jedi Knight II: Jedi Outcast" ]; then
glibcrequired="2.1"
glibcfix="no"
elif [ "${gamename}" == "TeamSpeak 3" ]; then
glibcrequired="NOT REQUIRED"
glibcfix="no"
Expand Down
Loading