16 changed files with 219 additions and 23 deletions
@ -0,0 +1,165 @@ |
|||||
|
#!/bin/bash |
||||
|
# Insurgency |
||||
|
# Server Management Script |
||||
|
# Author: Daniel Gibbs |
||||
|
# Website: http://gameservermanagers.com |
||||
|
|
||||
|
version="190116" |
||||
|
|
||||
|
# File fetching settings |
||||
|
# Github Branch Select |
||||
|
# Allows for the use of different function files |
||||
|
# from a different repo and/or branch. |
||||
|
githubuser="jaredballou" |
||||
|
githubrepo="linuxgsm" |
||||
|
githubbranch="master" |
||||
|
|
||||
|
# Update stale files on the fly using Git |
||||
|
git_update=0 |
||||
|
|
||||
|
#### Variables #### |
||||
|
|
||||
|
# The name of this script file, used to show the LGSM link properly |
||||
|
selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}")) |
||||
|
|
||||
|
# Name of this service (for symlinked instances) |
||||
|
servicename="$(basename $0)" |
||||
|
|
||||
|
# Directories |
||||
|
|
||||
|
# Script root |
||||
|
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
||||
|
# LGSM Support Files - set ro rootdir for old behavior |
||||
|
lgsmdir="${rootdir}/lgsm" |
||||
|
# Temporary path to store and manipulate settings |
||||
|
settingsdir="${lgsmdir}/settings.tmp" |
||||
|
# Supported Game Data |
||||
|
gamedatadir="${lgsmdir}/cfg/gamedata" |
||||
|
# Config path for local instances |
||||
|
scriptcfgdir="${lgsmdir}/cfg/servers" |
||||
|
# Temporary cache location |
||||
|
cachedir="${lgsmdir}/tmp" |
||||
|
|
||||
|
# Git last commit file (for tracking updates) |
||||
|
lastcommit_file="${cachedir}/lastcommit" |
||||
|
|
||||
|
|
||||
|
# Debugging, if debugflag exists send output to $debuglog |
||||
|
debugflag="${lgsmdir}/.dev-debug" |
||||
|
debuglog="${lgsmdir}/dev-debug.log" |
||||
|
if [ -f "${debugflag}" ]; then |
||||
|
exec 5>${debuglog} |
||||
|
BASH_XTRACEFD="5" |
||||
|
set -x |
||||
|
fi |
||||
|
|
||||
|
#ipaddr=$(ip addr show $(ip route | grep '^default' | awk '{print $NF}') | grep 'inet ' | awk '{print $2}' | cut -f1 -d'/') |
||||
|
|
||||
|
##### Script ##### |
||||
|
# Do not edit |
||||
|
|
||||
|
# fn_colortext color msg |
||||
|
# Display a message with a color code |
||||
|
# Paremeters: |
||||
|
# color: Numeric color code |
||||
|
# msg: Message. This includes all further paremeters, so there is no need to quote a message with spaces in it. |
||||
|
fn_colortext(){ |
||||
|
#Black 0;30 Dark Gray 1;30 |
||||
|
#Red 0;31 Light Red 1;31 |
||||
|
#Green 0;32 Light Green 1;32 |
||||
|
#Brown/Orange 0;33 Yellow 1;33 |
||||
|
#Blue 0;34 Light Blue 1;34 |
||||
|
#Purple 0;35 Light Purple 1;35 |
||||
|
#Cyan 0;36 Light Cyan 1;36 |
||||
|
#Light Gray 0;37 White 1;37 |
||||
|
case "${1}" in |
||||
|
green) |
||||
|
color="\033[0;32m";; |
||||
|
yellow) |
||||
|
color="\033[0;33m";; |
||||
|
reset) |
||||
|
color="\033[0m";; |
||||
|
red) |
||||
|
color="\033[0;31m";; |
||||
|
*) |
||||
|
color="\033[0;${1}m";; |
||||
|
esac |
||||
|
echo -e "[${color}${@:2}\e[0m]" |
||||
|
} |
||||
|
|
||||
|
# Set fetchcmd to the full path of whatever command we can to fetch files |
||||
|
for fetchcmd in curl wget |
||||
|
do |
||||
|
paths="$(command -v ${fetchcmd} 2>/dev/null) $(which ${fetchcmd} >/dev/null 2>&1) /usr/bin/${fetchcmd} /bin/${fetchcmd} /usr/sbin/${fetchcmd} /sbin/${fetchcmd} $(echo $PATH | sed "s/\([:]\|\$\)/\/${fetchcmd} /g")" |
||||
|
for tp in $paths |
||||
|
do |
||||
|
if [ -x $tp ]; then |
||||
|
fetchcmd=$tp |
||||
|
break 2 |
||||
|
fi |
||||
|
done |
||||
|
done |
||||
|
# If we have no executable fetchcmd, fail script execution |
||||
|
if [ ! -x "${fetchcmd}" ]; then |
||||
|
fn_colortext 31 FAIL |
||||
|
echo "Cannot find curl or wget!" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# fn_getgithubfile filename [exec] [url] |
||||
|
# Download file from Github |
||||
|
# Parameters: |
||||
|
# filename: The path of the file in reference to the repository root |
||||
|
# exec: Optional, set to 1 to make file executable |
||||
|
# url: Optional, set to full path under repository root if different than filename |
||||
|
fn_getgithubfile(){ |
||||
|
filename=$1 |
||||
|
exec=$2 |
||||
|
fileurl=${3:-$filename} |
||||
|
force=$4 |
||||
|
filepath="${lgsmdir}/${filename}" |
||||
|
filedir=$(dirname "${filepath}") |
||||
|
|
||||
|
# If the function file is missing, then download |
||||
|
if [ ! -f "${filepath}" ] || [ "${force}" != "" ]; then |
||||
|
if [ ! -d "${filedir}" ]; then |
||||
|
mkdir -p "${filedir}" |
||||
|
fi |
||||
|
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}" |
||||
|
echo -ne " fetching ${filename} (${githuburl})... " |
||||
|
if [ "$(basename ${fetchcmd})" == "curl" ]; then |
||||
|
cmd="$fetchcmd -s --fail -o" |
||||
|
elif [ "$(basename ${fetchcmd})" == "wget" ]; then |
||||
|
cmd="$fetchcmd -O" |
||||
|
fi |
||||
|
fetch=$($cmd "${filepath}" "${githuburl}" 2>&1) |
||||
|
if [ "${exec}" != "" ]; then |
||||
|
chmod +x "${filepath}" |
||||
|
fi |
||||
|
fn_colortext 32 "DONE" |
||||
|
fi |
||||
|
if [ "${exec}" == "1" ]; then |
||||
|
source "${filepath}" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# fn_runfunction |
||||
|
fn_runfunction(){ |
||||
|
scriptfile=${1:-$functionfile} |
||||
|
functionfile=$scriptfile |
||||
|
fn_getgithubfile "functions/${functionfile}" 1 |
||||
|
fn_check_github_files "${lgsmdir}" "${lgsmdir}/functions/${functionfile}" |
||||
|
} |
||||
|
|
||||
|
# Load GitHub hashing and updating functions |
||||
|
fn_runfunction github_hash.sh |
||||
|
|
||||
|
# Process game configs and load variables needed to run script |
||||
|
fn_runfunction game_settings.sh |
||||
|
|
||||
|
# Load core functions |
||||
|
fn_runfunction core_functions.sh |
||||
|
|
||||
|
# Get option from command line and run option parser |
||||
|
getopt=$1 |
||||
|
core_getopt.sh |
@ -0,0 +1,43 @@ |
|||||
|
arkserver "ARK: Survival Evolved" |
||||
|
arma3server "Arma 3" |
||||
|
bb2server "BrainBread 2" |
||||
|
bmdmserver "Black Mesa" |
||||
|
bsserver "Blade Symphony" |
||||
|
csczserver "Counter Strike: Condition Zero" |
||||
|
csgoserver "Counter Strike: Global Offensive" |
||||
|
csserver "Counter Strike" |
||||
|
cssserver "Counter Strike: Source" |
||||
|
dabserver "Double Action: Boogaloo" |
||||
|
dmcserver "Deathmatch Classic" |
||||
|
dodserver "Day Of Defeat" |
||||
|
dodsserver "Day Of Defeat: Source" |
||||
|
dstserver "Don't Starve Together" |
||||
|
fofserver "Fistful Of Frags" |
||||
|
gesserver "GoldenEye: Source" |
||||
|
gmodserver "Garry's Mod" |
||||
|
hl2dmserver "Half Life 2: Deathmatch" |
||||
|
hldmserver "Half Life: Deathmatch" |
||||
|
hldmsserver "Half-Life Deathmatch: Source" |
||||
|
hwserver "Hurtworld" |
||||
|
insserver "Insurgency" |
||||
|
jc2server "Just Cause 2" |
||||
|
kfserver "Killing Floor" |
||||
|
l4d2server "Left 4 Dead 2" |
||||
|
l4dserver "Left 4 Dead" |
||||
|
nmrihserver "No More Room In Hell" |
||||
|
ns2cserver "NS2: Combat" |
||||
|
ns2server "Natural Selection 2" |
||||
|
opforserver "Opposing Force" |
||||
|
pvkiiserver "Pirates, Vikings, and Knights II" |
||||
|
pzserver "Project Zomboid" |
||||
|
ricochetserver "Ricochet" |
||||
|
roserver "Red Orchestra" |
||||
|
sbserver "StarBound" |
||||
|
sdtdserver "7 Days To Die" |
||||
|
ss3sserver "Serious Sam 3: BFE" |
||||
|
terrariaserver "Terraria" |
||||
|
tf2server "Team Fortress 2" |
||||
|
tfcserver "Team Fortress Classic" |
||||
|
twserver "Teeworlds" |
||||
|
ut2k4server "Unreal Tournament 2004" |
||||
|
ut99server "Unreal Tournament 99" |
@ -1,12 +0,0 @@ |
|||||
# Game Settings File |
|
||||
# Import Engine |
|
||||
fn_import_game_settings _default |
|
||||
|
|
||||
fn_parms(){ |
|
||||
parms="" |
|
||||
} |
|
||||
|
|
||||
fn_set_game_params settings "appid" "261140" |
|
||||
fn_set_game_params settings "servicename" "jc2-server" |
|
||||
fn_set_game_params settings "gamename" "Just Cause 2" |
|
||||
|
|
Loading…
Reference in new issue