From 86d9f0cd315c9ac91dac9e8baf6c27895464f79a Mon Sep 17 00:00:00 2001 From: Jared Ballou Date: Wed, 20 Jan 2016 20:31:16 -0500 Subject: [PATCH] Updated gamedata files so gamename is equivalent to the directory names in the repo. Renamed PiratesVikingandKnightsII to PiratesVikingsandKnightsII since it was missing the s in Vikings. Added new file __game_list in gamedata that has all the gamenames for the available servers, this will be used by the new installer feature. Created _MasterScript directory and lgsm script in it, this will be the new core script location. --- .../cfg/lgsm-default.cfg | 0 .../pvkiiserver | 0 _MasterScript/lgsm | 165 ++++++++++++++++++ gamedata/__game_list | 43 +++++ gamedata/arkserver | 2 +- gamedata/arma3server | 2 +- gamedata/bmdmserver | 2 +- gamedata/csserver | 2 +- gamedata/dodserver | 2 +- gamedata/dodsserver | 2 +- gamedata/fofserver | 2 +- gamedata/nmrihserver | 2 +- gamedata/opforserver | 2 +- gamedata/roserver | 2 +- gamedata/sbserver | 2 +- gamedata/tests_jc2server.sh | 12 -- 16 files changed, 219 insertions(+), 23 deletions(-) rename {PiratesVikingandKnightsII => PiratesVikingsandKnightsII}/cfg/lgsm-default.cfg (100%) rename {PiratesVikingandKnightsII => PiratesVikingsandKnightsII}/pvkiiserver (100%) create mode 100755 _MasterScript/lgsm create mode 100644 gamedata/__game_list delete mode 100644 gamedata/tests_jc2server.sh diff --git a/PiratesVikingandKnightsII/cfg/lgsm-default.cfg b/PiratesVikingsandKnightsII/cfg/lgsm-default.cfg similarity index 100% rename from PiratesVikingandKnightsII/cfg/lgsm-default.cfg rename to PiratesVikingsandKnightsII/cfg/lgsm-default.cfg diff --git a/PiratesVikingandKnightsII/pvkiiserver b/PiratesVikingsandKnightsII/pvkiiserver similarity index 100% rename from PiratesVikingandKnightsII/pvkiiserver rename to PiratesVikingsandKnightsII/pvkiiserver diff --git a/_MasterScript/lgsm b/_MasterScript/lgsm new file mode 100755 index 000000000..4254ce3c6 --- /dev/null +++ b/_MasterScript/lgsm @@ -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 diff --git a/gamedata/__game_list b/gamedata/__game_list new file mode 100644 index 000000000..0d2766532 --- /dev/null +++ b/gamedata/__game_list @@ -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" diff --git a/gamedata/arkserver b/gamedata/arkserver index a2744f9e2..302b4398c 100644 --- a/gamedata/arkserver +++ b/gamedata/arkserver @@ -11,7 +11,7 @@ parms="TheIsland?listen" fn_set_game_params settings "appid" "376030" fn_set_game_params settings "game" "ShooterGame" -fn_set_game_params settings "gamename" "ARK: Survivial Evolved" +fn_set_game_params settings "gamename" "ARK: Survival Evolved" fn_set_game_params settings "systemdir" "\${filesdir}/\${game}" fn_set_game_params settings "gamelogdir" "\${systemdir}/logs" diff --git a/gamedata/arma3server b/gamedata/arma3server index 33742cfcb..cfc80af3c 100644 --- a/gamedata/arma3server +++ b/gamedata/arma3server @@ -10,7 +10,7 @@ fn_set_game_params settings "mods" "" "Mods" fn_set_game_params settings "servermods" "" "Server Mods" fn_set_game_params settings "bepath" "" "BattleEye Path" fn_set_game_params settings "appid" "233780" "For Development branch, use \"233780 -beta development\"" -fn_set_game_params settings "gamename" "ARMA 3" +fn_set_game_params settings "gamename" "Arma 3" fn_set_game_params settings "executabledir" "\${filesdir}" fn_set_game_params settings "executable" "./arma3server" fn_set_game_params settings "servercfg" "\${servicename}.server.cfg" diff --git a/gamedata/bmdmserver b/gamedata/bmdmserver index da1cbf62b..77d61d67e 100644 --- a/gamedata/bmdmserver +++ b/gamedata/bmdmserver @@ -8,4 +8,4 @@ parms="-game bms -strictportbind -ip ${ip} -port ${port} +clientport ${clientpor fn_set_game_params settings "appid" "346680" fn_set_game_params settings "game" "bms" fn_set_game_params settings "defaultmap" "dm_bounce" -fn_set_game_params settings "gamename" "Black Mesa: Deathmatch" +fn_set_game_params settings "gamename" "Black Mesa" diff --git a/gamedata/csserver b/gamedata/csserver index 0153fba12..f0078b07f 100644 --- a/gamedata/csserver +++ b/gamedata/csserver @@ -11,4 +11,4 @@ parms="-game cstrike -strictportbind +ip ${ip} -port ${port} +clientport ${clien fn_set_game_params settings "appid" "90" fn_set_game_params settings "defaultmap" "de_dust2" fn_set_game_params settings "game" "cstrike" -fn_set_game_params settings "gamename" "Counter Strike 1.6" +fn_set_game_params settings "gamename" "Counter Strike" diff --git a/gamedata/dodserver b/gamedata/dodserver index 22868c4d1..0c701b00a 100644 --- a/gamedata/dodserver +++ b/gamedata/dodserver @@ -9,4 +9,4 @@ parms="-game dod -strictportbind +ip ${ip} -port ${port} +clientport ${clientpor fn_set_game_params settings "appid" "90" fn_set_game_params settings "defaultmap" "dod_Anzio" fn_set_game_params settings "game" "dod" -fn_set_game_params settings "gamename" "Day of Defeat" +fn_set_game_params settings "gamename" "Day Of Defeat" diff --git a/gamedata/dodsserver b/gamedata/dodsserver index 42f4ebff6..643842a2c 100644 --- a/gamedata/dodsserver +++ b/gamedata/dodsserver @@ -9,4 +9,4 @@ parms="-game dod -strictportbind -ip ${ip} -port ${port} +clientport ${clientpor fn_set_game_params settings "appid" "232290" fn_set_game_params settings "defaultmap" "dod_Anzio" fn_set_game_params settings "game" "dod" -fn_set_game_params settings "gamename" "Day of Defeat: Source" +fn_set_game_params settings "gamename" "Day Of Defeat: Source" diff --git a/gamedata/fofserver b/gamedata/fofserver index c44350c6f..6a06150b4 100644 --- a/gamedata/fofserver +++ b/gamedata/fofserver @@ -9,4 +9,4 @@ parms="-game fof -strictportbind -ip ${ip} -port ${port} +clientport ${clientpor fn_set_game_params settings "appid" "295230" fn_set_game_params settings "defaultmap" "fof_depot" fn_set_game_params settings "game" "fof" -fn_set_game_params settings "gamename" "Fistful of Frags" +fn_set_game_params settings "gamename" "Fistful Of Frags" diff --git a/gamedata/nmrihserver b/gamedata/nmrihserver index ebfeeda94..c7a5c8dd4 100644 --- a/gamedata/nmrihserver +++ b/gamedata/nmrihserver @@ -9,5 +9,5 @@ parms="-game nmrih -insecure -strictportbind -ip ${ip} -port ${port} +clientport fn_set_game_params settings "appid" "317670" fn_set_game_params settings "defaultmap" "nmo_broadway" fn_set_game_params settings "game" "nmrih" -fn_set_game_params settings "gamename" "No More Room in Hell" +fn_set_game_params settings "gamename" "No More Room In Hell" fn_set_game_params settings "maxplayers" "8" diff --git a/gamedata/opforserver b/gamedata/opforserver index d15a2793a..026cbd91d 100644 --- a/gamedata/opforserver +++ b/gamedata/opforserver @@ -9,5 +9,5 @@ parms="-game gearbox -strictportbind +ip ${ip} -port ${port} +clientport ${clien fn_set_game_params settings "appid" "90" fn_set_game_params settings "defaultmap" "op4_bootcamp" fn_set_game_params settings "game" "gearbox" -fn_set_game_params settings "gamename" "Half-Life: Opposing Force" +fn_set_game_params settings "gamename" "Opposing Force" fn_set_game_params settings "maxplayers" "16" diff --git a/gamedata/roserver b/gamedata/roserver index 73974d900..f8cbe9863 100644 --- a/gamedata/roserver +++ b/gamedata/roserver @@ -6,7 +6,7 @@ fn_parms(){ parms="server ${defaultmap}?game=ROGame.ROTeamGame?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}" } -fn_set_game_params settings "gamename" "Red Orchestra: Ostfront 41-45" +fn_set_game_params settings "gamename" "Red Orchestra" fn_set_game_params settings "appid" "223250" fn_set_game_params settings "defaultmap" "RO-Arad.rom" diff --git a/gamedata/sbserver b/gamedata/sbserver index 685d52d1d..a7655161a 100644 --- a/gamedata/sbserver +++ b/gamedata/sbserver @@ -6,7 +6,7 @@ fn_parms(){ parms="" } fn_set_game_params settings "appid" "211820" -fn_set_game_params settings "gamename" "Starbound" +fn_set_game_params settings "gamename" "StarBound" fn_set_game_params settings "game" "starbound" fn_set_game_params settings "executabledir" "${filesdir}/linux64" fn_set_game_params settings "executable" "./starbound_server" diff --git a/gamedata/tests_jc2server.sh b/gamedata/tests_jc2server.sh deleted file mode 100644 index 4c3b86e32..000000000 --- a/gamedata/tests_jc2server.sh +++ /dev/null @@ -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" -