diff --git a/.gitignore b/.gitignore index 2b0bcabc1..59c91bc99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ *.db -.idea \ No newline at end of file +.idea +*/functions/* +*/cfg/servers/* +*/lgsm/* + diff --git a/GarrysMod/addons.sh b/GarrysMod/addons.sh new file mode 100755 index 000000000..8eb0888ec --- /dev/null +++ b/GarrysMod/addons.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# +# This is a temporary tool which I am using to look into Git cloning of addons. +# The list lives in this script for the time being, and this is not ready for production! + +# Root directory where addons live. Create it if missing. +addons_root=~/serverfiles/garrysmod/addons +if [ ! -e $addons_root ] +then + mkdir -p $addons_root +fi + +# Git protocol to use for fetching repos, options are "ssh" and "https" +git_protocol="ssh" + +# List of addons to manage, an array of comma-delimted strings. Format is user,repo,branch,method +addons_list=( + "nrlulz,ACF,master,zip", + "wiremod,advdupe2,master,tarball", + "wiremod,wire,master,clone" +) + +# Program flow + +for addon_data in ${addons_list[@]} +do + # Split addon data into separate fields + IFS=, read githubuser githubrepo githubbranch gitmethod <<< "${addon_data}" + echo "Managing ${githubuser}/${githubrepo}..." + + # Get current release + current_release_url="https://api.github.com/repos/${githubuser}/${githubrepo}/git/refs/heads/${githubbranch}" + current_release=$(curl -s -L $current_release_url | grep '"sha"' | cut -d'"' -f4) + + # Addon path has the repo name in lower-case for gmod linux weirdness + addon_lcase=$(echo $githubrepo | tr '[:upper:]' '[:lower:]') + addon_path="${addons_root}/${addon_lcase}" + + # Archive type to download + # Do the update/install + case "${gitmethod}" in + # Allow archive download/deployment as one method of installation + tar|tarball|archive|download|zip|zipfile|zipball) + if [ "${gitmethod}" == "zip" ] || [ "${gitmethod}" == "zipfile" ] || [ "${gitmethod}" == "zipball" ] + then + archive_format="zipball" + else + archive_format="tarball" + fi + + echo "Using archive (${archive_format})" + # Download archive if it's not present. This will require we leave the archives in place, so we need to think about that + archive_url="https://github.com/${githubuser}/${githubrepo}/${archive_format}/${githubbranch}" + + # Get filename of latest archive, this includes the commit hash + archive_file="${addons_root}/$(curl -sLI $archive_url | grep -o -E '^Content-Disp.*filename=.*$' | sed -e 's/.*filename=//' -e 's/[\x01-\x1F\x7F]//g')" + archive_unpack=$(echo $archive_file | sed -e 's/\.\(tar\.gz\|tar\|zip\)$//g') + archive_linktarget=$(basename $archive_unpack) + # If the unpacked directory isn't there, download and deploy + # FIXME: There needs to be a better way of tracking installs that doesn't require leaving archives lying around. Cleanup would be good. + if [ ! -e $archive_unpack ] + then + # TODO: Should we uninstall or delete the old addon? Any configs or other data that need to be retained? + # TODO: Checksum the downloaded files and remove/retry if corrupt + echo "Fetching ${githubrepo} ($(basename $archive_file))..." + curl -s -L -o $archive_file $archive_url + if [ "${archive_format}" == "zipfile" ] + then + # Unzip file + unzip $archive_file -d $addons_path + else + # Untar. FIXME: Assuming gzip, should probably have a little logic here. + # This descends one directory so we get rid of the directory with the same name as the archive + tar xzvpf $archive_file -C $addons_path + fi + fi + + # Update symlink. This will BLOW AWAY a real directory, may want to adjust that behavior. + if [ "$(basename $(readlink -f $addon_path))" != "${archive_linktarget}" ] + then + echo "Pointing ${addon_lcase} to ${archive_linktarget}" + ln -nsf $archive_linktarget "${addon_path}" + fi + ;; + # Otherwise, use Git natively + *) + echo "Using Native Git" + # Get repo URL based upon our protocol + if [ "${git_protocol}" == "ssh" ] + then + repo_url="git@github.com:${githubuser}/${githubrepo}.git" + else + repo_url="https://github.com/${githubuser}/${githubrepo}.git" + fi + + # Clone repo if it does not exist + if [ ! -e $addon_path ] + then + cd $addons_root && git clone $repo_url $addon_lcase + fi + + # Init repo if directory has no .git subdirectory + if [ ! -e $addon_path ] + then + cd $addons_root && git init + fi + + # Check to make sure we have the right remote + repo_remote=$(cd $addon_path && git remote -v | grep '^origin' | grep '\(fetch\)' | awk '{print $2}') + if [ "${repo_remote}" != "${repo_url}" ] + then + # TODO: Possibly delete incorrect remotes? + cd $addon_path && git remote add -f -t $githubbranch -m $githubbranch origin $repo_url + fi + + # Check to make sure we are on the latest commit + repo_commit=$(cd $addon_path && git show | head -n1 | awk '{print $2}') + if [ "${repo_commit}" != "${current_release}" ] + then + cd $addon_path && git pull origin $githubbranch + fi + ;; + esac + echo "Up to date" +done diff --git a/Insurgency/insserver b/Insurgency/insserver old mode 100644 new mode 100755 index e43d5e752..4254ce3c6 --- a/Insurgency/insserver +++ b/Insurgency/insserver @@ -3,137 +3,163 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://gameservermanagers.com -if [ -f ".dev-debug" ]; then - exec 5>dev-debug.log - BASH_XTRACEFD="5" - set -x -fi - -version="271215" -#### Variables #### - -# Notification Email -# (on|off) -emailnotification="off" -email="email@example.com" - -# Steam login -steamuser="anonymous" -steampass="" - -# Start Variables -defaultmap="ministry" -maxplayers="16" -tickrate="64" -port="27015" -sourcetvport="27020" -clientport="27005" -ip="0.0.0.0" -updateonstart="off" - -# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server -fn_parms(){ -parms="-game insurgency -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" -} - -#### Advanced Variables #### +version="190116" +# File fetching settings # Github Branch Select # Allows for the use of different function files # from a different repo and/or branch. -githubuser="dgibbs64" +githubuser="jaredballou" githubrepo="linuxgsm" githubbranch="master" -# Steam -appid="237410" +# 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]}")) -# Server Details -servicename="ins-server" -gamename="Insurgency" -engine="source" +# Name of this service (for symlinked instances) +servicename="$(basename $0)" # Directories -rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" -selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" -lockselfname=".${servicename}.lock" -filesdir="${rootdir}/serverfiles" -systemdir="${filesdir}/insurgency" -executabledir="${filesdir}" -executable="./srcds_linux" -servercfg="${servicename}.cfg" -servercfgdir="${systemdir}/cfg" -servercfgfullpath="${servercfgdir}/${servercfg}" -servercfgdefault="${servercfgdir}/lgsm-default.cfg" -backupdir="${rootdir}/backups" - -# Logging -logdays="7" -gamelogdir="${systemdir}/logs" -scriptlogdir="${rootdir}/log/script" -consolelogdir="${rootdir}/log/console" - -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 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} -filepath="${rootdir}/${filename}" -filedir=$(dirname "${filepath}") -# If the function file is missing, then download -if [ ! -f "${filepath}" ]; then - if [ ! -d "${filedir}" ]; then - mkdir "${filedir}" - fi - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}" - echo -e " fetching ${filename}...\c" - if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then - : - else - echo -e "\e[0;31mFAIL\e[0m\n" - echo "Curl is not installed!" - echo -e "" - exit + 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 - curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1) - if [ $? -ne 0 ]; then - echo -e "\e[0;31mFAIL\e[0m\n" - echo "${curl}" - echo -e "${githuburl}\n" - exit - else - echo -e "\e[0;32mOK\e[0m" - fi - if [ "${exec}" ]; then - chmod +x "${filepath}" + if [ "${exec}" == "1" ]; then + source "${filepath}" fi -fi -if [ "${exec}" ]; 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}" } -core_functions.sh(){ -# Functions are defined in core_functions.sh. -functionfile="${FUNCNAME}" -fn_runfunction -} +# 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 -core_functions.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/Insurgency/cfg/lgsm-default.cfg b/Insurgency/lgsm/cfg/lgsm-default.cfg similarity index 100% rename from Insurgency/cfg/lgsm-default.cfg rename to Insurgency/lgsm/cfg/lgsm-default.cfg diff --git a/Insurgency/dependencies/libc.so.6 b/Insurgency/lgsm/dependencies/libc.so.6 similarity index 100% rename from Insurgency/dependencies/libc.so.6 rename to Insurgency/lgsm/dependencies/libc.so.6 diff --git a/Insurgency/dependencies/libm.so.6 b/Insurgency/lgsm/dependencies/libm.so.6 similarity index 100% rename from Insurgency/dependencies/libm.so.6 rename to Insurgency/lgsm/dependencies/libm.so.6 diff --git a/Insurgency/dependencies/libpthread.so.0 b/Insurgency/lgsm/dependencies/libpthread.so.0 similarity index 100% rename from Insurgency/dependencies/libpthread.so.0 rename to Insurgency/lgsm/dependencies/libpthread.so.0 diff --git a/Insurgency/dependencies/librt.so.1 b/Insurgency/lgsm/dependencies/librt.so.1 similarity index 100% rename from Insurgency/dependencies/librt.so.1 rename to Insurgency/lgsm/dependencies/librt.so.1 diff --git a/Insurgency/manifest.sh b/Insurgency/manifest.sh new file mode 100755 index 000000000..82b0864e9 --- /dev/null +++ b/Insurgency/manifest.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# LGSM git manifest functions +# Author: Jared Ballou +# Website: http://gameservermanagers.com +# +# This is another one of my POC tools. Eventually I want to have a pretty robust update/download system here +# Goals: +# * Keep function files up to date on client machines +# * Deploy other programs or support tools +# * Learn more about GitHub API +# * Parse JSON in Bash + +# fn_getgithash filename +# Calculate the Git hash for a file +function fn_get_git_hash(){ + filename=$1 + if [ -e $filename ] + then + filesize=$(stat --format='%s' $filename) + if [ "$(tail -c1 $filename)" == "" ]; then + printf "blob %d\0%s\n" "${filesize}" "$(cat $filename)" | sha1sum | awk '{print $1}' + else + printf "blob %d\0%s" "${filesize}" "$(cat $filename)" | sha1sum | awk '{print $1}' + fi +# printf "blob %d\0%s" "$(stat --format='%s' $filename)" "$(awk '{print $0}' $filename)" | sha1sum | awk '{print $1}' + fi +} + + +fn_githget_ub_manifest(){ + # Create cache directory if missing + if [ ! -e "${cachedir}" ] + then + mkdir -p "${cachedir}" + fi + # Get latest commit from GitHub. Cache file for 60 minutes + if [ -e $lastcommit_file ]; then + if [ $(($(date +%s) - $(date -r ${lastcommit_file} +%s))) -gt 3600 ]; then + fetch=1 + else + fetch=0 + fi + else + fetch=1 + fi + if [ $fetch -eq 1 ]; then + echo "Fetching ${lastcommit_file}" + curl -s "https://api.github.com/repos/${githubuser}/${githubrepo}/git/refs/heads/${githubbranch}" -o "${lastcommit_file}.json" + ${lgsmdir}/functions/jq-linux64 -r '.object.sha' "${lastcommit_file}.json" > "${lastcommit_file}" + fi + # Get manifest of all files at this revision in GitHub. These hashes are what we use to compare and select files that need to be updated. + manifest="${cachedir}/$(cat "${lastcommit_file}").manifest" + if [ ! -e "${manifest}.json" ]; then + curl -Ls "https://api.github.com/repos/${githubuser}/${githubrepo}/git/trees/${githubbranch}?recursive=1" -o "${manifest}.json" + fi + if [ ! -e "${manifest}" ]; then + ${lgsmdir}/functions/jq-linux64 -r '.tree[] | .path + " " + .sha' "${manifest}.json" > "${manifest}" + fi +} +# Check files against manifest +fn_github_checkfiles(){ + prefix=$1 + files=${@:2} + fn_github_manifest + manifest="${cachedir}/$(cat "${lastcommit_file}").manifest" + # Check all files in functions for updates + for file in $files + do + if [ -d $file ]; then + echo "Descending into ${file}..." + fn_github_checkfiles "${prefix}" ${file}/* + else + myhash=$(fn_getgithash $file) + repofile=$(echo $file | sed -e "s|${1}[/]*||g") + githash=$(grep "^$repofile " $manifest 2>/dev/null| cut -d" " -f2) + if [ "${githash}" == "" ] + then + echo "Can't find ${repofile} in git!" + elif [ "${myhash}" != "${githash}" ] + then + echo "Would fetch ${repofile}: have ${myhash}, expected ${githash}" + else + echo "${repofile} is OK" + fi + fi + done +} +lgsmdir="./lgsm" +cachedir="${lgsmdir}/tmp" +lastcommit_file="${cachedir}/lastcommit" +fn_github_checkfiles $lgsmdir ${lgsmdir}/functions 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-core b/_MasterScript/lgsm-core new file mode 100755 index 000000000..4b8059683 --- /dev/null +++ b/_MasterScript/lgsm-core @@ -0,0 +1,177 @@ +#!/bin/bash +# Insurgency +# Server Management Script +# Author: Daniel Gibbs +# Website: http://gameservermanagers.com + +version="200116" + +# 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}/gamedata" +# Config path for local instances +scriptcfgdir="${lgsmdir}/cfg/servers" +# Temporary cache location +cachedir="${lgsmdir}/tmp" + +# Create all the directories we need +for dir in $(grep '^[a-zA-Z0-9]*dir=' $0 | cut -d'=' -f1); do + if [ ! -e "${!dir}" ]; then + echo "Creating ${dir} at ${!dir}" + mkdir -p "${!dir}" + fi +done +# 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 + +# Load core functions +fn_runfunction core_functions.sh + +if [ "${selfname}" == "lgsm-core" ]; +then + fn_runfunction install_lgsm.sh +else + # Process game configs and load variables needed to run script + fn_runfunction game_settings.sh + + # Get option from command line and run option parser + getopt=$1 + core_getopt.sh +fi diff --git a/functions/check_root.sh b/functions/check_root.sh index 8f2e5ed54..148ecb30b 100644 --- a/functions/check_root.sh +++ b/functions/check_root.sh @@ -4,7 +4,10 @@ # Website: http://gameservermanagers.com lgsm_version="271215" -if [ $(whoami) = "root" ]; then +# If you want to run as root (i.e. in Docker, or just because you hate security) +# set the following variable in your environment or config scripts. +#I_KNOW_THIS_IS_A_BAD_IDEA=YES +if [ $(whoami) = "root" ] && [ "${I_KNOW_THIS_IS_A_BAD_IDEA}" != "YES" ]; then fn_printfailnl "Do NOT run this script as root!" if [ -d "${scriptlogdir}" ]; then fn_scriptlog "${selfname} attempted to run as root." diff --git a/functions/command_backup.sh b/functions/command_backup.sh index 5f923ad07..1f3baf924 100644 --- a/functions/command_backup.sh +++ b/functions/command_backup.sh @@ -49,7 +49,7 @@ sleep 1 echo -en "starting backup...\r" sleep 1 echo -en "\n" -cd "${rootdir}" +cd "${lgsmdir}" if [ ! -d "${backupdir}" ]; then mkdir -v "${backupdir}" fi diff --git a/functions/command_dev_detect_deps.sh b/functions/command_dev_detect_deps.sh index 30f89157d..e33fcbd1c 100644 --- a/functions/command_dev_detect_deps.sh +++ b/functions/command_dev_detect_deps.sh @@ -41,62 +41,62 @@ else readelf=readelf fi -${readelf} -d ${executable} |grep NEEDED|awk '{ print $5 }'|sed 's/\[//g'|sed 's/\]//g' > "${rootdir}/.depdetect_readelf" +${readelf} -d ${executable} |grep NEEDED|awk '{ print $5 }'|sed 's/\[//g'|sed 's/\]//g' > "${lgsmdir}/.depdetect_readelf" -echo "yum install " > "${rootdir}/.depdetect_centos_list_uniq" -echo "apt-get install " > "${rootdir}/.depdetect_ubuntu_list_uniq" -echo "apt-get install " > "${rootdir}/.depdetect_debian_list_uniq" +echo "yum install " > "${lgsmdir}/.depdetect_centos_list_uniq" +echo "apt-get install " > "${lgsmdir}/.depdetect_ubuntu_list_uniq" +echo "apt-get install " > "${lgsmdir}/.depdetect_debian_list_uniq" while read lib; do sharedlib=${lib} if [ "${lib}" == "libm.so.6" ]||[ "${lib}" == "libc.so.6" ]||[ "${lib}" == "libpthread.so.0" ]||[ "${lib}" == "libdl.so.2" ]||[ "${lib}" == "libnsl.so.1" ]||[ "${lib}" == "libgcc_s.so.1" ]||[ "${lib}" == "librt.so.1" ]||[ "${lib}" == "ld-linux.so.2" ]; then - echo "glibc.i686" >> "${rootdir}/.depdetect_centos_list" - echo "lib32gcc1" >> "${rootdir}/.depdetect_ubuntu_list" - echo "lib32gcc1" >> "${rootdir}/.depdetect_debian_list" + echo "glibc.i686" >> "${lgsmdir}/.depdetect_centos_list" + echo "lib32gcc1" >> "${lgsmdir}/.depdetect_ubuntu_list" + echo "lib32gcc1" >> "${lgsmdir}/.depdetect_debian_list" elif [ "${lib}" == "libstdc++.so.6" ]; then - echo "libstdc++.i686" >> "${rootdir}/.depdetect_centos_list" - echo "libstdc++6:i386" >> "${rootdir}/.depdetect_ubuntu_list" - echo "libstdc++6:i386" >> "${rootdir}/.depdetect_debian_list" + echo "libstdc++.i686" >> "${lgsmdir}/.depdetect_centos_list" + echo "libstdc++6:i386" >> "${lgsmdir}/.depdetect_ubuntu_list" + echo "libstdc++6:i386" >> "${lgsmdir}/.depdetect_debian_list" elif [ "${lib}" == "libstdc++.so.5" ]; then - echo "compat-libstdc++-33.i686" >> "${rootdir}/.depdetect_centos_list" - echo "libstdc++5:i386" >> "${rootdir}/.depdetect_ubuntu_list" - echo "libstdc++5:i386" >> "${rootdir}/.depdetect_debian_list" + echo "compat-libstdc++-33.i686" >> "${lgsmdir}/.depdetect_centos_list" + echo "libstdc++5:i386" >> "${lgsmdir}/.depdetect_ubuntu_list" + echo "libstdc++5:i386" >> "${lgsmdir}/.depdetect_debian_list" elif [ "${lib}" == "libspeex.so.1" ]||[ "${lib}" == "libspeexdsp.so.1" ]; then - echo "speex.i686" >> "${rootdir}/.depdetect_centos_list" - echo "speex:i386" >> "${rootdir}/.depdetect_ubuntu_list" - echo "speex:i386" >> "${rootdir}/.depdetect_debian_list" + echo "speex.i686" >> "${lgsmdir}/.depdetect_centos_list" + echo "speex:i386" >> "${lgsmdir}/.depdetect_ubuntu_list" + echo "speex:i386" >> "${lgsmdir}/.depdetect_debian_list" elif [ "${lib}" == "./libSDL-1.2.so.0" ]||[ "${lib}" == "libSDL-1.2.so.0" ]; then - echo "SDL.i686" >> "${rootdir}/.depdetect_centos_list" - echo "libsdl1.2debian" >> "${rootdir}/.depdetect_ubuntu_list" - echo "libsdl1.2debian" >> "${rootdir}/.depdetect_debian_list" + echo "SDL.i686" >> "${lgsmdir}/.depdetect_centos_list" + echo "libsdl1.2debian" >> "${lgsmdir}/.depdetect_ubuntu_list" + echo "libsdl1.2debian" >> "${lgsmdir}/.depdetect_debian_list" elif [ "${lib}" == "libtbb.so.2" ]; then - echo "tbb.i686" >> "${rootdir}/.depdetect_centos_list" - echo "libtbb2" >> "${rootdir}/.depdetect_ubuntu_list" - echo "libtbb2" >> "${rootdir}/.depdetect_debian_list" + echo "tbb.i686" >> "${lgsmdir}/.depdetect_centos_list" + echo "libtbb2" >> "${lgsmdir}/.depdetect_ubuntu_list" + echo "libtbb2" >> "${lgsmdir}/.depdetect_debian_list" elif [ "${lib}" == "libtier0.so" ]||[ "${lib}" == "Core.so" ]||[ "${lib}" == "Editor.so" ]||[ "${lib}" == "Engine.so" ]||[ "${lib}" == "liblua.so" ]||[ "${lib}" == "libsteam_api.so" ]||[ "${lib}" == "ld-linux-x86-64.so.2" ]||[ "${lib}" == "libPhysX3_x86.so" ]||[ "${lib}" == "libPhysX3Common_x86.so" ]||[ "${lib}" == "libPhysX3Cooking_x86.so" ]; then # Known shared libs what dont requires dependencies : else unknownlib=1 - echo "${lib}" >> "${rootdir}/.depdetect_unknown" + echo "${lib}" >> "${lgsmdir}/.depdetect_unknown" fi -done < "${rootdir}/.depdetect_readelf" -sort "${rootdir}/.depdetect_centos_list" | uniq >> "${rootdir}/.depdetect_centos_list_uniq" -sort "${rootdir}/.depdetect_ubuntu_list" | uniq >> "${rootdir}/.depdetect_ubuntu_list_uniq" -sort "${rootdir}/.depdetect_debian_list" | uniq >> "${rootdir}/.depdetect_debian_list_uniq" +done < "${lgsmdir}/.depdetect_readelf" +sort "${lgsmdir}/.depdetect_centos_list" | uniq >> "${lgsmdir}/.depdetect_centos_list_uniq" +sort "${lgsmdir}/.depdetect_ubuntu_list" | uniq >> "${lgsmdir}/.depdetect_ubuntu_list_uniq" +sort "${lgsmdir}/.depdetect_debian_list" | uniq >> "${lgsmdir}/.depdetect_debian_list_uniq" if [ "${unknownlib}" == "1" ]; then - sort "${rootdir}/.depdetect_unknown" | uniq >> "${rootdir}/.depdetect_unknown_uniq" + sort "${lgsmdir}/.depdetect_unknown" | uniq >> "${lgsmdir}/.depdetect_unknown_uniq" fi -awk -vORS=' ' '{ print $1, $2 }' "${rootdir}/.depdetect_centos_list_uniq" > "${rootdir}/.depdetect_centos_line" -awk -vORS=' ' '{ print $1, $2 }' "${rootdir}/.depdetect_ubuntu_list_uniq" > "${rootdir}/.depdetect_ubuntu_line" -awk -vORS=' ' '{ print $1, $2 }' "${rootdir}/.depdetect_debian_list_uniq" > "${rootdir}/.depdetect_debian_line" +awk -vORS=' ' '{ print $1, $2 }' "${lgsmdir}/.depdetect_centos_list_uniq" > "${lgsmdir}/.depdetect_centos_line" +awk -vORS=' ' '{ print $1, $2 }' "${lgsmdir}/.depdetect_ubuntu_list_uniq" > "${lgsmdir}/.depdetect_ubuntu_line" +awk -vORS=' ' '{ print $1, $2 }' "${lgsmdir}/.depdetect_debian_list_uniq" > "${lgsmdir}/.depdetect_debian_line" echo "" echo "Required Dependencies" @@ -105,46 +105,46 @@ echo "${executable}" echo "" echo "CentOS" echo "=================================" -cat "${rootdir}/.depdetect_centos_line" +cat "${lgsmdir}/.depdetect_centos_line" echo "" echo "" echo "Ubuntu" echo "=================================" -cat "${rootdir}/.depdetect_ubuntu_line" +cat "${lgsmdir}/.depdetect_ubuntu_line" echo "" echo "" echo "Debian" echo "=================================" -cat "${rootdir}/.depdetect_debian_line" +cat "${lgsmdir}/.depdetect_debian_line" echo "" if [ "${unknownlib}" == "1" ]; then echo "" echo "Unknown shared Library" echo "=================================" - cat "${rootdir}/.depdetect_unknown" + cat "${lgsmdir}/.depdetect_unknown" fi echo "" echo "Required Librarys" echo "=================================" -sort "${rootdir}/.depdetect_readelf" |uniq +sort "${lgsmdir}/.depdetect_readelf" |uniq echo "" echo "ldd" echo "=================================" ldd ${executable} echo -en "\n" -rm -f "${rootdir}/.depdetect_centos_line" -rm -f "${rootdir}/.depdetect_centos_list" -rm -f "${rootdir}/.depdetect_centos_list_uniq" +rm -f "${lgsmdir}/.depdetect_centos_line" +rm -f "${lgsmdir}/.depdetect_centos_list" +rm -f "${lgsmdir}/.depdetect_centos_list_uniq" -rm -f "${rootdir}/.depdetect_debian_line" -rm -f "${rootdir}/.depdetect_debian_list" -rm -f "${rootdir}/.depdetect_debian_list_uniq" +rm -f "${lgsmdir}/.depdetect_debian_line" +rm -f "${lgsmdir}/.depdetect_debian_list" +rm -f "${lgsmdir}/.depdetect_debian_list_uniq" -rm -f "${rootdir}/.depdetect_ubuntu_line" -rm -f "${rootdir}/.depdetect_ubuntu_list" -rm -f "${rootdir}/.depdetect_ubuntu_list_uniq" +rm -f "${lgsmdir}/.depdetect_ubuntu_line" +rm -f "${lgsmdir}/.depdetect_ubuntu_list" +rm -f "${lgsmdir}/.depdetect_ubuntu_list_uniq" -rm -f "${rootdir}/.depdetect_readelf" +rm -f "${lgsmdir}/.depdetect_readelf" -rm -f "${rootdir}/.depdetect_unknown" -rm -f "${rootdir}/.depdetect_unknown_uniq" \ No newline at end of file +rm -f "${lgsmdir}/.depdetect_unknown" +rm -f "${lgsmdir}/.depdetect_unknown_uniq" diff --git a/functions/command_monitor.sh b/functions/command_monitor.sh index f253abc54..0a691866b 100644 --- a/functions/command_monitor.sh +++ b/functions/command_monitor.sh @@ -16,7 +16,7 @@ logs.sh fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 -if [ ! -f "${rootdir}/${lockselfname}" ]; then +if [ ! -f "${lgsmdir}/${lockselfname}" ]; then fn_printinfo "Disabled: No lock file found" fn_scriptlog "Disabled: No lock file found" sleep 1 @@ -59,7 +59,7 @@ info_config.sh fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 -if [ ! -f "${rootdir}/${lockselfname}" ]; then +if [ ! -f "${lgsmdir}/${lockselfname}" ]; then fn_printinfo "Disabled: No lock file found" fn_scriptlog "Disabled: No lock file found" sleep 1 diff --git a/functions/command_start.sh b/functions/command_start.sh index 309a8078f..ebd38b76b 100644 --- a/functions/command_start.sh +++ b/functions/command_start.sh @@ -53,7 +53,7 @@ fi mv "${scriptlog}" "${scriptlogdate}" # Create lock file -date > "${rootdir}/${lockselfname}" +date > "${lgsmdir}/${lockselfname}" cd "${executabledir}" if [ "${ts3serverpass}" == "1" ];then ./ts3server_startscript.sh start serveradmin_password="${newpassword}" @@ -65,7 +65,7 @@ info_ts3status.sh if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then fn_printfailnl "Unable to start ${servername}" fn_scriptlog "Unable to start ${servername}" - echo -e " Check log files: ${rootdir}/log" + echo -e " Check log files: ${lgsmdir}/log" exit 1 else fn_printok "${servername}" @@ -112,7 +112,7 @@ if [ "${tmuxwc}" -eq 1 ]; then fi # Create lock file -date > "${rootdir}/${lockselfname}" +date > "${lgsmdir}/${lockselfname}" cd "${executabledir}" tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp" # tmux pipe-pane not supported in tmux versions < 1.6 diff --git a/functions/command_stop.sh b/functions/command_stop.sh index 98d21c9a5..1c4304be0 100644 --- a/functions/command_stop.sh +++ b/functions/command_stop.sh @@ -44,7 +44,7 @@ else fn_scriptlog "Stopped ${servername}" fi # Remove lock file -rm -f "${rootdir}/${lockselfname}" +rm -f "${lgsmdir}/${lockselfname}" sleep 1 echo -en "\n" } @@ -147,7 +147,7 @@ else fi fi # Remove lock file - rm -f "${rootdir}/${lockselfname}" + rm -f "${lgsmdir}/${lockselfname}" sleep 1 echo -en "\n" } @@ -156,4 +156,4 @@ if [ "${gamename}" == "Teamspeak 3" ]; then fn_stop_teamspeak3 else fn_stop_tmux -fi \ No newline at end of file +fi diff --git a/functions/core_functions.sh b/functions/core_functions.sh index 560a2ee26..e8d522175 100644 --- a/functions/core_functions.sh +++ b/functions/core_functions.sh @@ -10,84 +10,84 @@ lgsm_version="060116" #Legacy functions fn_functions(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fn_getopt(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Core core_getopt.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } core_messages.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Command command_console.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_debug.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_details.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_email_test.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_backup.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_monitor.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_start.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_stop.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_validate.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_install.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_ts3_server_pass.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fn_restart(){ @@ -102,196 +102,196 @@ command_start.sh # Checks check.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } check_config.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } check_ip.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } check_logs.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } check_root.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } check_steamcmd.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } check_steamuser.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } check_systemdir.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } check_tmux.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Compress compress_unreal2_maps.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } compress_ut99_maps.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Dev command_dev_debug.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } command_dev_detect_deps.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Fix fix.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_arma3.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_csgo.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_dst.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_ins.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_steamcmd.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_glibc.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_ro.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_kf.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_ut2k4.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Info info_config.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } info_distro.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } info_glibc.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } info_ts3status.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Email email.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Logs logs.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Monitor monitor_gsquery.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Update update_check.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } update_functions.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } update_dl.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } update_functions.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } @@ -305,92 +305,94 @@ command_install.sh } install_complete.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_config.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_gsquery.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_gslt.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_header.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_logs.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_retry.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_serverdir.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_serverfiles.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" +} +install_sourcemod.sh(){ +fn_runfunction "${FUNCNAME}" } install_steamcmd.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_ts3.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_ts3db.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_ut2k4.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_dl_ut2k4.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_ut2k4_key.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_ut99.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } install_dl_ut99.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } fix_ut99.sh(){ -functionfile="${FUNCNAME}" -fn_runfunction +fn_runfunction "${FUNCNAME}" + } # Calls on-screen messages diff --git a/functions/core_getopt.sh b/functions/core_getopt.sh index 95196d0ef..7bf402b33 100644 --- a/functions/core_getopt.sh +++ b/functions/core_getopt.sh @@ -41,6 +41,8 @@ case "$getopt" in command_install.sh;; ai|auto-install) fn_autoinstall;; + sm|sourcemod) + install_sourcemod.sh;; dd|depsdetect) command_dev_detect_deps.sh;; *) @@ -65,6 +67,7 @@ case "$getopt" in echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." echo -e "\e[34minstall\t\e[0mInstall the server." echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." + echo -e "\e[34msourcemod\t\e[0mInstall SourceMod." } | column -s $'\t' -t esac exit @@ -424,4 +427,4 @@ elif [ "${engine}" == "unreal" ]; then fn_getopt_unreal else fn_getopt_generic -fi \ No newline at end of file +fi diff --git a/functions/core_messages.sh b/functions/core_messages.sh index 939e73889..d92228ec4 100644 --- a/functions/core_messages.sh +++ b/functions/core_messages.sh @@ -6,6 +6,18 @@ lgsm_version="271215" # Description: Defines on-screen messages such as [ OK ] and how script logs look. +# Print text center-aligned +fn_print_center() { + columns="$(tput cols)" + line="$@" + printf "%*s\n" $(( (${#line} + columns) / 2)) "$line" +} +# Print horizontal line +fn_print_horizontal(){ + char="${1:-=}" + printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}" +} + # Date and servicename for log files. fn_scriptlog(){ if [ -n "${modulename}" ]; then @@ -145,4 +157,4 @@ fn_printokeol(){ # FAIL for end of line fn_printfaileol(){ echo -e "\e[0;31mFAIL\e[0m\n" -} \ No newline at end of file +} diff --git a/functions/fn_update_functions b/functions/fn_update_functions index 185f44f5e..51964e14f 100644 --- a/functions/fn_update_functions +++ b/functions/fn_update_functions @@ -10,7 +10,7 @@ fn_printdots "Updating functions" fn_scriptlog "Updating functions" sleep 1 echo -ne "\n" -rm -rfv "${rootdir}/functions/"* +rm -rfv "${lgsmdir}/functions/"* exitcode=$? if [ "${exitcode}" == "0" ]; then fn_printok "Updating functions" @@ -19,4 +19,4 @@ else fn_printokfail "Updating functions" fn_scriptlog "Failure! Updating functions" fi -echo -ne "\n" \ No newline at end of file +echo -ne "\n" diff --git a/functions/game_settings.sh b/functions/game_settings.sh new file mode 100644 index 000000000..74af87f93 --- /dev/null +++ b/functions/game_settings.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# LGSM game_settings.sh function +# Author: Jared Ballou +# Website: http://gameservermanagers.com +lgsm_version="180116" + +function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" +local modulename="Settings" + +# Config files +cfg_file_default="${scriptcfgdir}/_default.cfg" +cfg_file_common="${scriptcfgdir}/_common.cfg" +cfg_file_instance="${scriptcfgdir}/${servicename}.cfg" + +# Config file headers +cfg_header_all="# Your settings for all servers go in _common.cfg\n# Server-specific settings go into \$SERVER.cfg" +cfg_header_default="# Default config - Changes will be overwritten by updates.\n${cfg_header_all}" +cfg_header_common="# Common config - Will not be overwritten by script.\n${cfg_header_all}" +cfg_header_instance="# Instance Config for ${servicename} - Will not be overwritten by script.\n${cfg_header_all}" + + +# If default config does not exist, create it. This should come from Git, and will be overwritten by updates. +# Rather than try to wget it from Github or other fancy ways to get it, the simplest way to ensure it works is to simply create it here. +fn_update_config() +{ + key=$1 + val=$2 + cfg_file=${3:-$cfg_file_default} + comment=${4:-""} + + # Get current key/value pair from file + exists=$(grep "^${key}=" $cfg_file 2>/dev/null) + exists_comment=$(echo $(echo $exists | cut -d'#' -f2-)) + case "${val}" in + ""|"--UNSET--") + if [ "${exists}" != "" ]; then + echo "Removing ${key} from ${cfg_file}" + sed "/${key}=.*/d" -i $cfg_file + fi + return + ;; + "--EMPTY--") + val="" + ;; + esac + # Put " # " at beginning of comment if not empty + if [ "${comment}" != "" ] + then + comment=" # ${comment}" + else + if [ "${exists_comment}" != "" ]; then + comment=" # ${exists_comment}" + fi + fi + + # Line to be put in + data="${key}=\"${val}\"${comment}" + + # Check if key exists in config + if [ "${exists}" != "" ]; then + # If the line isn't the same as the parsed data line, replace it + if [ "${exists}" != "${data}" ]; then + #echo "Updating ${data} in ${cfg_file}" + sed -e "s%^${key}=.*\$%${data}%g" -i $cfg_file + #sed "/${key}=.*/${data}/" -i $cfg_file + fi + else + # If value does not exist, append to file + #echo "Adding ${data} to ${cfg_file}" + echo -ne "${data}\n" >> $cfg_file + fi +} + +fn_create_config(){ + cfg_type=${1:-default} + cfg_force=$2 + cfg_file="cfg_file_${cfg_type}" + cfg_header="cfg_header_${cfg_type}" + + cfg_dir=$(dirname ${!cfg_file}) + #If config directory does not exist, create it + if [ ! -e $cfg_dir ]; then mkdir -p $cfg_dir; fi + + # Create file header if needed + if [ ! -e ${!cfg_file} ] || [ "${cfg_force}" != "" ]; then + echo "Creating ${cfg_type} config at ${!cfg_file}" + echo -ne "${!cfg_header}\n\n" > ${!cfg_file} + # Dump in defaults for this game + if [ "${cfg_type}" == "default" ]; then + cat ${settingsdir}/settings >> ${!cfg_file} + fi + fi +} + +fn_flush_game_settings(){ + if [ -e $settingsdir ]; then + rm -rf $settingsdir > /dev/null + fi + mkdir -p $settingsdir +} + +fn_import_game_settings(){ + import="${gamedatadir}/${1}" + importdir=$(echo "${gamedatadir}" | sed -e "s|${lgsmdir}/||g") + #echo $importdir + if [ ! -e $import ]; then + fn_getgithubfile "${importdir}/${1}" 1 "gamedata/${1}" + fi + source $import +} + +fn_set_game_params(){ + param_set=$1 + param_name=$2 + param_value=$3 + param_comment=$4 + fn_update_config "${param_name}" "${param_value}" "${settingsdir}/${param_set}" "${param_comment}" +} + + +fn_get_game_params(){ + param_set=$1 + param_name=$2 + param_default=$3 +} + +# Flush old setings buffer +fn_flush_game_settings + +# Import this game's settings +fn_import_game_settings $selfname + +# New method is to always run this function, it will overwrite defaults with whatever the new script values are +cfg_version_default=$(grep '^lgsm_version="' "${cfg_file_default}" 2>&1 | cut -d'"' -f2) +if [ "${cfg_version_default}" != "${version}" ]; then + fn_create_config default 1 +fi + +# Load defaults +source $cfg_file_default + +# Load sitewide common settings (so that Git updates can safely overwrite default.cfg) +if [ ! -f $cfg_file_common ]; then fn_create_config common; else source $cfg_file_common; fi + +# Load instance specific settings +if [ ! -f $cfg_file_instance ]; then fn_create_config instance; else source $cfg_file_instance; fi diff --git a/functions/github_hash.sh b/functions/github_hash.sh new file mode 100755 index 000000000..e78450d58 --- /dev/null +++ b/functions/github_hash.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# LGSM git manifest functions +# Author: Jared Ballou +# Website: http://gameservermanagers.com +# +# This is another one of my POC tools. Eventually I want to have a pretty robust update/download system here +# Goals: +# * Keep function files up to date on client machines +# * Deploy other programs or support tools +# * Learn more about GitHub API +# * Parse JSON in Bash + +# fn_get_git_hash $filename +# Calculate the Git hash for a file +function fn_get_git_hash(){ + filename=$1 + if [ -e $filename ]; then + gitcmd="$(which git)" + if [ -x "${gitcmd}" ]; then + $gitcmd hash-object "${filename}" + else + filesize=$(stat --format='%s' $filename) + if [ "$(tail -c1 $filename)" == "" ]; then + printf "blob %d\0%s\n" "${filesize}" "$(cat $filename)" | sha1sum | awk '{print $1}' + else + printf "blob %d\0%s" "${filesize}" "$(cat $filename)" | sha1sum | awk '{print $1}' + fi + fi + fi +} + +fn_get_github_manifest(){ + # Create cache directory if missing + if [ ! -e "${cachedir}" ]; then + mkdir -p "${cachedir}" + fi + fn_getgithubfile "functions/jq-linux64" + jq_path="${lgsmdir}/functions/jq-linux64" + chmod +x "${jq_path}" + # Get latest commit from GitHub. Cache file for 60 minutes + if [ -e $lastcommit_file ]; then + if [ $(($(date +%s) - $(date -r ${lastcommit_file} +%s))) -gt 3600 ]; then + fetch=1 + else + fetch=0 + fi + else + fetch=1 + fi + if [ $fetch -eq 1 ]; then + echo "Fetching ${lastcommit_file}" + curl -s "https://api.github.com/repos/${githubuser}/${githubrepo}/git/refs/heads/${githubbranch}" -o "${lastcommit_file}.json" + "${jq_path}" -r '.object.sha' "${lastcommit_file}.json" > "${lastcommit_file}" + fi + # Get manifest of all files at this revision in GitHub. These hashes are what we use to compare and select files that need to be updated. + manifest="${cachedir}/$(cat "${lastcommit_file}").manifest" + if [ ! -e "${manifest}.json" ]; then + curl -Ls "https://api.github.com/repos/${githubuser}/${githubrepo}/git/trees/${githubbranch}?recursive=1" -o "${manifest}.json" + fi + if [ ! -e "${manifest}" ]; then + "${jq_path}" -r '.tree[] | .path + " " + .sha' "${manifest}.json" > "${manifest}" + fi +} + +# Check files against manifest +fn_check_github_files(){ + # Return unless turned on + if [ "${git_update}" != "1" ]; then return; fi + + prefix=$1 + files=${@:2} + fn_get_github_manifest + manifest="${cachedir}/$(cat "${lastcommit_file}").manifest" + # Check all files in functions for updates + for file in $files; do + if [ -d $file ]; then + #echo "Descending into ${file}..." + fn_check_github_files "${prefix}" ${file}/* + else + myhash=$(fn_get_git_hash $file) + repofile=$(echo $file | sed -e "s|${1}[/]*||g") + githash=$(grep "^$repofile " $manifest 2>/dev/null| cut -d" " -f2) + if [ "${githash}" == "" ]; then + echo "Can't find ${repofile} in git!" + elif [ "${myhash}" != "${githash}" ]; then + #echo "Would fetch ${repofile}: have ${myhash}, expected ${githash}" + fn_getgithubfile "${repofile}" 0 "${repofile}" 1 + fi + fi + done +} diff --git a/functions/install_gsquery.sh b/functions/install_gsquery.sh index a113ea829..143357553 100644 --- a/functions/install_gsquery.sh +++ b/functions/install_gsquery.sh @@ -5,7 +5,7 @@ lgsm_version="271215" fn_dlgsquery(){ -cd "${rootdir}" +cd "${lgsmdir}" echo -e "downloading gsquery.py...\c" wget -N /dev/null "http://gameservermanagers.com/dl/gsquery.py" 2>&1 | grep -F "HTTP" | grep -v "Moved Permanently" | cut -c45- | uniq chmod +x gsquery.py diff --git a/functions/install_lgsm.sh b/functions/install_lgsm.sh new file mode 100644 index 000000000..0eb1ee111 --- /dev/null +++ b/functions/install_lgsm.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# LGSM install_lgsm function +# Author: Jared Ballou +# Website: http://gameservermanagers.com +lgsm_version="200116" + +# Description: Display menu of available games and install the one selected + +# Perform installation +fn_runfunction menu.sh +# Listing of available games +gamelist="gamedata/__game_list" +# Installation path +installpath=$(cd ~ && pwd) +# Get game list +fn_getgithubfile $gamelist +# Display installer menu +fn_menu result "Linux Game Server Manager" "Select game to install" "${lgsmdir}/${gamelist}" +# If we have a selection, do the install +if [ -n "${result}" ]; then + # Confirm path for installation + read -p "Select path to install ${result} [${installpath}]: " input + installpath=${input:-$installpath} + scriptpath="${installpath}/${result}" + # If file exists, confirm overwrite + if [ -e "${scriptpath}" ]; then + read -p "WARNING! ${scriptpath} already exists! OVERWRITE!? [y/N]: " input + if [ "${input}" != "y" ] && [ "${input}" != "Y" ]; then exit; fi + fi + # Install script + echo -ne "Installing to ${scriptpath}... \c" + # Create directory if missing. TODO: Gravefully handle errors like giving a file as the install dir + if [ ! -e $(dirname "${scriptpath}") ]; then + mkdir -p $(dirname "${scriptpath}") + fi + # Copy script and set executable + cp "${0}" "${scriptpath}" + chmod 0755 "${scriptpath}" + if [ $? ]; then + fn_colortext green "Done" + echo "Script deployed to ${scriptpath}" + else + fn_colortext red "FAIL" + fi +fi diff --git a/functions/install_logs.sh b/functions/install_logs.sh index 6496ad647..9d4dcaca2 100644 --- a/functions/install_logs.sh +++ b/functions/install_logs.sh @@ -11,7 +11,7 @@ if [ "${checklogs}" != "1" ]; then fi sleep 1 # Create dir's for the script and console logs -mkdir -v "${rootdir}/log" +mkdir -v "${lgsmdir}/log" mkdir -v "${scriptlogdir}" touch "${scriptlog}" if [ -n "${consolelogdir}" ]; then @@ -21,8 +21,8 @@ fi # If a server is source or goldsource, Teamspeak 3, Starbound, Project Zomhoid create a symbolic link to the game server logs. if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${gamename}" == "Teamspeak 3" ]||[ "${engine}" == "starbound" ]||[ "${engine}" == "projectzomboid" ]; then - if [ ! -h "${rootdir}/log/server" ]; then - ln -nfsv "${gamelogdir}" "${rootdir}/log/server" + if [ ! -h "${lgsmdir}/log/server" ]; then + ln -nfsv "${gamelogdir}" "${lgsmdir}/log/server" fi fi @@ -40,8 +40,8 @@ fi # If server uses SteamCMD create a symbolic link to the Steam logs. if [ -d "${rootdir}/Steam/logs" ]; then - if [ ! -h "${rootdir}/log/steamcmd" ]; then - ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" + if [ ! -h "${lgsmdir}/log/steamcmd" ]; then + ln -nfsv "${rootdir}/Steam/logs" "${lgsmdir}/log/steamcmd" fi fi -sleep 1 \ No newline at end of file +sleep 1 diff --git a/functions/install_sourcemod.sh b/functions/install_sourcemod.sh new file mode 100755 index 000000000..f6f7095b2 --- /dev/null +++ b/functions/install_sourcemod.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# LGSM install_sourcemod.sh +# Author: Jared Ballou +# Website: http://gameservermanagers.com + +# This downloads and installs the latest stable versions of MetaMod and SourceMod + +lgsm_version="200116" + + +# MetaMod +fn_install_metamod(){ + # Get installation path for MetaMod + mm_path="${1:-"${systemdir}/addons/metamod"}" + mm_root=$(cd "$(dirname $(dirname "${mm_path}"))" && pwd) + if [ -e "${mm_path}" ]; then + read -p "WARNING! MetaMod exists at ${mm_path}! OVERWRITE!? [y/N]: " input + if [ "${input}" != "y" ] && [ "${input}" != "Y" ]; then return; fi + fi + # Download URL base + mm_url_base="http://www.sourcemm.net/downloads/" + # Get latest release file name + echo "Getting latest MetaMod version..." + mm_file_latest="$(curl -sL "${mm_url_base}" | grep -m1 -o "mmsource-[0-9\.a-zA-Z]*-linux\.tar\.gz")" + mm_file="${cachedir}/${mm_file_latest}" + # If file is not here, download it + if [ ! -e "${mm_file}" ]; then + echo -ne "Downloading ${mm_file_latest}... \c" + # Get mirror URLs + mm_file_urls="$(curl -sL "${mm_url_base}${mm_file_latest}" | grep -o -E 'href="http([^"#]+)mmsource-1.10.6-linux.tar.gz"' | cut -d'"' -f2)" + # Try each mirror + for url in $mm_file_urls; do + # Download file + curl -sL "${url}" -o "${mm_file}" + # If file downloaded, exit loop + if [ -e "${mm_file}" ]; then break; fi + done + if [ ! -e "${mm_file}" ]; then + fn_colortext red FAILED + exit 1 + else + fn_colortext green DONE + fi + fi + # Unzip MetaMod to addons + tar -xzvpf "${mm_file}" -C "${mm_root}" +} +fn_install_sourcemod(){ + # Get installation path for SourceMod + sm_path="${1:-"${systemdir}/addons/sourcemod"}" + sm_root=$(cd "$(dirname $(dirname "${sm_path}"))" && pwd) + if [ -e "${sm_path}" ]; then + read -p "WARNING! SourceMod exists at ${sm_path}! OVERWRITE!? [y/N]: " input + if [ "${input}" != "y" ] && [ "${input}" != "Y" ]; then return; fi + fi + # Install SourceMod to game server + sm_major_version="1.7" + sm_url_base="http://www.sourcemod.net/smdrop/${sm_major_version}/" + sm_url_latest="${sm_url_base}sourcemod-latest-linux" + sm_file_latest="$(curl -sL "${sm_url_latest}")" + sm_url_file="${sm_url_base}${sm_file_latest}" + sm_file="${cachedir}/${sm_file_latest}" + if [ ! -e "${sm_file}" ]; then + echo -ne "Downloading ${sm_file_latest}... \c" + curl -sL "${sm_url_file}" -o "${sm_file}" + if [ ! -e "${sm_file}" ]; then + fn_colortext red FAILED + exit 1 + else + fn_colortext green DONE + fi + fi + # Unzip SourceMod to addons + tar -xzvpf "${sm_file}" -C "${sm_root}" +} +fn_install_metamod +fn_install_sourcemod diff --git a/functions/install_ts3.sh b/functions/install_ts3.sh index 3860fbc50..252a4a4bc 100644 --- a/functions/install_ts3.sh +++ b/functions/install_ts3.sh @@ -48,7 +48,7 @@ if [ -z "${availablebuild}" ]; then exit 1 fi -cd "${rootdir}" +cd "${lgsmdir}" echo -e "downloading teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz...\c" wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux-${ts3arch}-${ts3_version_number}.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq sleep 1 @@ -65,7 +65,7 @@ else exit $? fi echo -e "copying to ${filesdir}...\c" -cp -R "${rootdir}/teamspeak3-server_linux-${ts3arch}/"* "${filesdir}" 2> ".${servicename}-cp-error.tmp" +cp -R "${lgsmdir}/teamspeak3-server_linux-${ts3arch}/"* "${filesdir}" 2> ".${servicename}-cp-error.tmp" local status=$? if [ ${status} -eq 0 ]; then echo "OK" @@ -77,4 +77,4 @@ else exit $? fi rm -f teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz -rm -rf "${rootdir}/teamspeak3-server_linux-${ts3arch}" +rm -rf "${lgsmdir}/teamspeak3-server_linux-${ts3arch}" diff --git a/functions/jq-linux64 b/functions/jq-linux64 new file mode 100755 index 000000000..939227e58 Binary files /dev/null and b/functions/jq-linux64 differ diff --git a/functions/menu.sh b/functions/menu.sh new file mode 100644 index 000000000..0e7dce75a --- /dev/null +++ b/functions/menu.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# LGSM fn_messages function +# Author: Jared Ballou +# Website: http://gameservermanagers.com +lgsm_version="200116" + +# Description: Display menus and return selection + +# Display simple Bash menu +fn_menu_bash() { + local resultvar=$1 + title=$2 + caption=$3 + options=$4 + fn_print_horizontal + fn_print_center $title + fn_print_center $caption + fn_print_horizontal + menu_options=() + while IFS='' read -r line || [[ -n "$line" ]]; do + menu_options+=( "${line}" ) + done < $options + menu_options+=( "Cancel" ) + select option in "${menu_options[@]}"; do + if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then + eval "$resultvar=\"${option/%\ */}\"" + fi + break + done +} + +# Draw menu using Whiptail +fn_menu_whiptail() { + local menucmd=$1 + local resultvar=$2 + title=$3 + caption=$4 + options=$5 + height=${6:-40} + width=${7:-80} + menuheight=${8:-30} + #whiptail --title "" --menu "" [ ] . . . + menu_options=() + while read -r key val; do + menu_options+=( ${key//\"} "${val//\"}" ) + done < $options + OPTION=$($menucmd --title "${title}" --menu "${caption}" $height $width $menuheight "${menu_options[@]}" 3>&1 1>&2 2>&3) + if [ $? = 0 ]; then + eval "$resultvar=\"${OPTION}\"" + else + eval "$resultvar=" + fi +} + +# Show menu and receive input. We try to see if whiptail/dialog is available +# for a pretty ncurses menu. If not, use Bash builtins. +fn_menu() { + local resultvar=$1 + local selection="" + title=$2 + caption=$3 + options=$4 + # If this is a list of options as a string, dump it to a file so we can process it + if [ ! -e $options ]; then + echo -ne "{$options}\n" > "${cachedir}/menu.options" + options="${cachedir}/menu.options" + fi + + # Get menu command + for menucmd in whiptail dialog bash; do + if [ -x $(which $menucmd) ]; then + menucmd=$(which $menucmd) + break + fi + done + case "$(basename $menucmd)" in + whiptail|dialog) + fn_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30 + ;; + *) + fn_menu_bash selection "${title}" "${caption}" "${options}" + ;; + esac + eval "$resultvar=\"${selection}\"" +} + +# Example usage: +# This will display a menu of available games to install +#fn_menu result "Linux Game Server Manager" "Select game to install" "../gamedata/__game_list" +#echo "result is ${result}" diff --git a/functions/monitor_gsquery.sh b/functions/monitor_gsquery.sh index 55e2e9fc2..e8f289c68 100644 --- a/functions/monitor_gsquery.sh +++ b/functions/monitor_gsquery.sh @@ -8,7 +8,7 @@ lgsm_version="271215" # Detects if the server has frozen. local modulename="Monitor" -if [ -f "${rootdir}/gsquery.py" ]; then +if [ -f "${lgsmdir}/gsquery.py" ]; then if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then gameport=$(grep Port= "${servercfgfullpath}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd '[:digit:]') port=$((${gameport} + 1)) @@ -30,7 +30,7 @@ if [ -f "${rootdir}/gsquery.py" ]; then fn_printdots "Querying port: ${ip}:${port} : QUERYING" fn_scriptlog "Querying port: ${ip}:${port} : QUERYING" sleep 1 - serverquery=$("${rootdir}/gsquery.py" -a ${ip} -p ${port} -e ${engine} 2>&1) + serverquery=$("${lgsmdir}/gsquery.py" -a ${ip} -p ${port} -e ${engine} 2>&1) exitcode=$? if [ "${exitcode}" == "1" ]||[ "${exitcode}" == "2" ]||[ "${exitcode}" == "3" ]||[ "${exitcode}" == "4" ]; then fn_printfail "Querying port: ${ip}:${port} : ${serverquery}" @@ -67,20 +67,20 @@ if [ -f "${rootdir}/gsquery.py" ]; then echo -en "\n" exit elif [ "${exitcode}" == "126" ]; then - fn_printfail "Querying port: ${ip}:${port} : ERROR: ${rootdir}/gsquery.py: Permission denied" - fn_scriptlog "Querying port: ${ip}:${port} : ERROR: ${rootdir}/gsquery.py: Permission denied" + fn_printfail "Querying port: ${ip}:${port} : ERROR: ${lgsmdir}/gsquery.py: Permission denied" + fn_scriptlog "Querying port: ${ip}:${port} : ERROR: ${lgsmdir}/gsquery.py: Permission denied" sleep 1 echo -en "\n" echo "Attempting to resolve automatically" - chmod +x -v "${rootdir}/gsquery.py" + chmod +x -v "${lgsmdir}/gsquery.py" if [ $? -eq 0 ]; then monitor_gsquery.sh else fn_printfailure "Unable to resolve automatically. Please manually fix permissions.\n" - owner=$(ls -al ${rootdir}/gsquery.py|awk '{ print $3 }') + owner=$(ls -al ${lgsmdir}/gsquery.py|awk '{ print $3 }') echo "As user ${owner} or root run the following command." whoami=$(whoami) - echo -en "\nchown ${whoami}:${whoami} ${rootdir}/gsquery.py\n\n" + echo -en "\nchown ${whoami}:${whoami} ${lgsmdir}/gsquery.py\n\n" exit 1 fi else @@ -88,10 +88,10 @@ if [ -f "${rootdir}/gsquery.py" ]; then fn_scriptlog "Querying port: ${ip}:${port} : UNKNOWN ERROR" sleep 1 echo -en "\n" - ${rootdir}/gsquery.py -a ${ip} -p ${port} -e ${engine} + ${lgsmdir}/gsquery.py -a ${ip} -p ${port} -e ${engine} exit 1 fi else - fn_printfailnl "Could not find ${rootdir}/gsquery.py" - fn_scriptlog "Could not find ${rootdir}/gsquery.py" + fn_printfailnl "Could not find ${lgsmdir}/gsquery.py" + fn_scriptlog "Could not find ${lgsmdir}/gsquery.py" fi diff --git a/functions/update_check.sh b/functions/update_check.sh index e0ba3ea96..d53813e95 100644 --- a/functions/update_check.sh +++ b/functions/update_check.sh @@ -206,7 +206,7 @@ if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then exit 1 fi fi -currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${rootdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') +currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${lgsmdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') # Gets the teamspeak server architecture ts3arch=$(ls $(find ${filesdir}/ -name 'ts3server_*_*' 2> /dev/null | grep -v 'ts3server_minimal_runscript.sh' | sort | tail -1) | egrep -o '(amd64|x86)' | tail -1) diff --git a/functions/update_dl.sh b/functions/update_dl.sh index 09bd3ebe9..954680ab3 100644 --- a/functions/update_dl.sh +++ b/functions/update_dl.sh @@ -28,7 +28,7 @@ fix.sh } fn_teamspeak3_dl(){ -cd "${rootdir}" +cd "${lgsmdir}" echo -e "downloading teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz...\c" fn_scriptlog "Downloading teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz" wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux-${ts3arch}-${ts3_version_number}.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq @@ -51,7 +51,7 @@ else fi echo -e "copying to ${filesdir}...\c" fn_scriptlog "Copying to ${filesdir}" -cp -R "${rootdir}/teamspeak3-server_linux-${ts3arch}/"* "${filesdir}" 2> "${scriptlogdir}/.${servicename}-cp-error.tmp" +cp -R "${lgsmdir}/teamspeak3-server_linux-${ts3arch}/"* "${filesdir}" 2> "${scriptlogdir}/.${servicename}-cp-error.tmp" local status=$? if [ ${status} -eq 0 ]; then echo "OK" @@ -66,7 +66,7 @@ else exit ${status} fi rm -f teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz -rm -rf "${rootdir}/teamspeak3-server_linux-${ts3arch}" +rm -rf "${lgsmdir}/teamspeak3-server_linux-${ts3arch}" } check.sh diff --git a/functions/update_functions.sh b/functions/update_functions.sh index 350714ed0..30958e7d8 100644 --- a/functions/update_functions.sh +++ b/functions/update_functions.sh @@ -12,7 +12,7 @@ fn_printdots "Updating functions" fn_scriptlog "Updating functions" sleep 1 echo -ne "\n" -rm -rfv "${rootdir}/functions/"* +rm -rfv "${lgsmdir}/functions/"* exitcode=$? if [ "${exitcode}" == "0" ]; then fn_printok "Updating functions" @@ -21,4 +21,4 @@ else fn_printokfail "Updating functions" fn_scriptlog "Failure! Updating functions" fi -echo -ne "\n" \ No newline at end of file +echo -ne "\n" diff --git a/gamedata/README.md b/gamedata/README.md new file mode 100644 index 000000000..8371f4c38 --- /dev/null +++ b/gamedata/README.md @@ -0,0 +1,113 @@ +# Game Data Files +## General Info +These files are the proof of concept of my new method of supporting all the games LGSM covers. It's basically a hierarchial way to define three things: + + * **Script Parameters:** These are things like executable, game name, local directories, and all the rest. + * **Server Parameters:** These are the command-line switches that we give to the actual game server daemon. There is a little bit of smarts around the Source and GoldSource parsers, we feed it "minus parameters" and "plus parameters", and it spits them out in a somewhat sane order. + * **Server Settings:** These are the items that go into \_default.cfg for each game. They include the values for the two types of parameters, and are overridden hierarchially by sourcing \_default.cfg, then \_common.cfg, then $instance.cfg from the cfg/servers directory. + +The gamedata files themselves use a few simple functions to do their magic. + +## Functions + +### fn\_flush\_game\_settings() +This function clears out all the collector files in $settingsdir (default is $\{lgsmdir\}/settings.tmp). It is run at every execution of the script right now, eventually the goal is to only regenerate these files when gamedata updates are pulled. + +### fn\_import\_game\_settings() + +This function takes one parameter, the name of the gamedata file to load. The main script calls it with the name of the main script file being called. With this method, the same "basic" script is used for all game servers, and we simply name it "insserver" or "csgoserver" for instance. Symlinks then pick up the main script to make this work for multiple-instance deployments. + +In the gamedata files themselves, they are used to pull in other gamedata files. This is done in sequence, so it's usually best to do the import at the top of the file, and then overwrite. It is possible to import multiple files inside a single gamedata file, for instance include \_source and \_source\_workshop to pull in Source engine sane defaults and the Workshop variables. Any "base" gamedata file (that is, not for a specific game) should be prefixed with a "\_". The gamedata files for each engine should be named "\_\$\{engine\}". + +### fn\_set\_game\_params() + +Takes four parameters: + + * **param\_set:** The set of key-value pairs to update. You can create as many sets as you want, the only restriction is the set name must validate as a usable file name. For instance, I use parms\_minus and parms\_plus to separate the "-" and "+" parameters for the Server, and then I parse them in fn\_parms() to assemble them. The reserved names are: + + * **settings**: which will be parsed into the values in cfg/servers/\*.cfg + * **parms**: Common name for server daemon parameters. Should have one key declared, also named "parms" which is a string of the command-line arguments to pass to the game server. + * **param\_name:** The "key", this will be a Bash variable name so it should only be alphanumeric if you want to parse it. The parms\_(minus|plus) files break this convention, as part of how we process them, but ideally they would all be able to be sourced and return the expectec values. + * **param\_value:** The "default" to set the key to. Should be a single string, escape all quotes. If you want to reference a variable, use the \$\{varname\} syntax, that way the actual value saved to that set will retain the variabe name, rather than interpolating. Special values are: + * **"--UNSET--"** or **"":** the parser will REMOVE that key from the param\_set. Useful if an engine usually has a certain parameter, but one specific game does not. This allows you to set the default in the engine gamedata file, and then just deletre it for the specific games that don't need it. + * **"--EMPTY--":** This will set the value to "" (an empty string) and add it to the param set. This is useful for parameters that must be defined, but have no default value. + * **param\_comment:** This is the comment to append at the end of the line. If overriding a key set earlier in the hierarchy, leaving this blank will reuse the original comment. If you want to delete the comment, use "--EMPTY--". + +### fn\_parms() + +This is the same old function from the original LGSM main scripts, the difference is we now have a "sane default" one in \_default that just dumps params, and then each engine/game can get fancy if need be. This function gets overridden by the highest-ordered declaration, and for most games the default should be fine. The idea here is that we define flexible functions in each engine, and then allow the games to add/modify/delete keys in the data. + +## Examples + +This is an example of a gamedata file for the Widgets engine. We'll call it \_widgets for the sake of argument: + +```bash +# Import default settings +fn_import_game_settings _default +# Use + and - parameters +fn_import_game_settings _parms_plusminus + +# The parms that start with - go first +fn_set_game_params parms_minus "tickrate" "\${tickrate}" +fn_set_game_params parms_minus "port" "\${port}" + +# Then the parms that start with + +fn_set_game_params parms_plus "+servercfgfile" "\${servercfg}" +fn_set_game_params parms_plus "+map" "\${defaultmap}" + +# And the settings for defaults +fn_set_game_params settings "appid" "99999" "Steam App ID" +fn_set_game_params settings "defaultmap" "my_map" "Default map to load" +fn_set_game_params settings "engine" "widgets" "Game Engine" +fn_set_game_params settings "game" "widgets" "Name of game to pass to srcds" +fn_set_game_params settings "gamename" "widgets" "Name for subdirectory in GitHub repo" +fn_set_game_params settings "port" "99999" "Port to bind for server" +fn_set_game_params settings "servercfg" "\${selfname}.cfg" "Server Config file" +fn_set_game_params settings "steampass" "--EMPTY--" "Steam Password" +fn_set_game_params settings "steamuser" "anonymous" "Steam Username" + +# These are values that the script uses, they don't get used by the srcds server directly +fn_set_game_params settings "systemdir" "\${filesdir}/\${game}" +fn_set_game_params settings "gamelogdir" "\${systemdir}/logs" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./widgets_server" +fn_set_game_params settings "servercfg" "\${servicename}.cfg" +fn_set_game_params settings "servercfgdir" "\${systemdir}/cfg" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.cfg" +``` + +Then, we need a game! DooDads is the name of the game, and just imports the defaults from its engine. + +```bash +# Import SRCDS +fn_import_game_settings _widgets + +# Delete tickrate parameter. This will remove it from the parameters, and remove it from _default.cfg +fn_set_game_params parms_minus "-tickrate" "--UNSET--" +fn_set_game_params settings "tickrate" "--UNSET--" + +# Add playlist parameter +fn_set_game_params parms_plus "+sv_playlist" "\${playlist}" + +# Override some server settings +fn_set_game_params settings "executable" "./doodads_server" +fn_set_game_params settings "appid" "100000" +fn_set_game_params settings "defaultmap" "special_map" +fn_set_game_params settings "game" "doodads" +fn_set_game_params settings "playlist" "custom" "Server Playlist" +fn_set_game_params settings "gamename" "DooDads" +``` + +With this, we inherit everything from \_widgets, but remove the tickrate setting, add playlist, and override some of the settings to make sure we install the right game via Steam. End users can then override the defaults in \_common.cfg and \$\{servicename\}.cfg for doing things their own way. The script will keep the gamedata files in sync with GitHub, as of right now the \_default.cfg is regenerated only when the \$lgsm\_version that created it differs from the script's \$version. The next step is to only regenerate the settings files when the gamedata itself is updated, which would be much more efficient. + +## TODO + + * [ ] Look into better handling of parms, especially with the "-" and "+" ordering in Source. + ** Perhaps put a "before" and "after" field in the parms, so we can do a little more complex ordering? + * [ ] Clean up gamedata files for all engines/games. + * [ ] When \_default.cfg updates, read all other configs. Add in commented key/value/comment lines so that other configs have the keys and default values available. + * [ ] Add dependency installation for games, simple array of packages needed for debian,ubuntu,redhat for each game. + * [ ] Allow values to append or replace individual items, i.e. for dependencies layer on the needed packages from \_default \_engine and game data files. + * [ ] Parser should read the value and identify variable names, and make sure that this key is declared after those variables that the value references. + * [ ] Move insserver script (the POC common LGSM script) somewhere else to denote its new role 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/_avalanche b/gamedata/_avalanche new file mode 100644 index 000000000..3c6157842 --- /dev/null +++ b/gamedata/_avalanche @@ -0,0 +1,25 @@ +# Game Settings File +# _avalanche +# Avalanche Engine + +fn_import_game_settings _default + +# And the settings for defaults +fn_set_game_params settings "engine" "avalanche" +fn_set_game_params settings "servercfg" "config.lua" "Server Config file" +fn_set_game_params settings "sourcetvport" "27020" "SourceTV Port" +fn_set_game_params settings "srcds_parms" "--EMPTY--" "Additional SRCDS Parameters. Put the parameters that start with \"-\" first, then \"+\" parameters after" +fn_set_game_params settings "steampass" "--EMPTY--" "Steam Password" +fn_set_game_params settings "steamuser" "anonymous" "Steam Username" +fn_set_game_params settings "tickrate" "64" "Server Tick Rate" + +# These are values that the script uses, they don't get used by the srcds server directly +fn_set_game_params settings "systemdir" "\${filesdir}" +fn_set_game_params settings "gamelogdir" "--EMPTY--" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./Jcmp-Server" +fn_set_game_params settings "servercfg" "config.lua" +fn_set_game_params settings "servercfgdir" "\${filesdir}" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/default_config.lua" + diff --git a/gamedata/_default b/gamedata/_default new file mode 100644 index 000000000..f179cd9a0 --- /dev/null +++ b/gamedata/_default @@ -0,0 +1,52 @@ +# Game Settings File +# _default +# Base defaults for all games + +# Set the default settings for the script + +# Default settings. This group includes a lot of blanks just so that the comments are set (and the engine/game files will show blank values to remind people to set them). +fn_set_game_params settings "appid" "--EMPTY--" "Steam App ID" +fn_set_game_params settings "backupdir" "\${lgsmdir}/backups" "Backup Directory" +fn_set_game_params settings "defaultmap" "--EMPTY--" "Default map to load" +fn_set_game_params settings "email" "email@example.com" "Email address for notification" +fn_set_game_params settings "emaillog" "\${scriptlogdir}/\${servicename}-email.log" "Email Log" +fn_set_game_params settings "emailnotification" "off" "Email notification (on|off)" +fn_set_game_params settings "engine" "--EMPTY--" "Game Engine" +fn_set_game_params settings "filesdir" "\${rootdir}/serverfiles" "Server Files Directory" +fn_set_game_params settings "game" "--EMPTY--" "Name of game" +fn_set_game_params settings "gamename" "--EMPTY--" "Name for subdirectory in GitHub repo" +fn_set_game_params settings "ip" "0.0.0.0" "IP Address to bind for server" +fn_set_game_params settings "lgsm_version" "${version}" "Version of LGSM that created this config" +fn_set_game_params settings "lockselfname" ".\${servicename}.lock" "LGSM Lock File" +fn_set_game_params settings "logdays" "7" "Number of days to retain logs" +fn_set_game_params settings "maxplayers" "--EMPTY--" "Maximum player count" +fn_set_game_params settings "port" "--EMPTY--" "Port to bind for server" +fn_set_game_params settings "steampass" "--EMPTY--" "Steam Password" +fn_set_game_params settings "steamuser" "anonymous" "Steam Username" +fn_set_game_params settings "updateonstart" "off" "Update game on start" + +# These settings are in a second group, since they reference the first group. +fn_set_game_params settings "consolelogdir" "\${lgsmdir}/log/console" "Console Log Dir" +fn_set_game_params settings "consolelog" "\${consolelogdir}/\${servicename}-console.log" "Console Log" +fn_set_game_params settings "consolelogdate" "\${consolelogdir}/\${servicename}-console-\$(date '+%d-%m-%Y-%H-%M-%S').log" "Console Log Rotation Filename" + +fn_set_game_params settings "scriptlogdir" "\${lgsmdir}/log/script" "Script Log Dir" +fn_set_game_params settings "scriptlog" "\${scriptlogdir}/\${servicename}-script.log" "Script Log" +fn_set_game_params settings "scriptlogdate" "\${scriptlogdir}/\${servicename}-script-\$(date '+%d-%m-%Y-%H-%M-%S').log" "Script Log Rotation Filename" + +fn_set_game_params settings "servercfg_suffix" ".cfg" "Suffix to put on the end of the server config. For file extensions, use \".ext\", setting to empty will use the bare server config name." +fn_set_game_params settings "systemdir" "\${filesdir}/\${game}" "System Directory (root of game installation)" +fn_set_game_params settings "gamelogdir" "\${systemdir}/logs" "Game log directory" + +fn_set_game_params settings "executabledir" "\${filesdir}" "Executable directory" +fn_set_game_params settings "executable" "--EMPTY--" "Executable to invoke to start game server" + +fn_set_game_params settings "servercfgdir" "\${systemdir}/cfg" "Server config directory" +fn_set_game_params settings "servercfg" "\${servicename}\${servercfg_suffix}" "Server config file for this instance" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default\${servercfg_suffix}" "Default server configuration file" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" "Full path to server config" + +# Default fn_parms just loads the parms file. Still need to figure out how to handle "simple" parms. +fn_parms(){ + source "${settingsdir}/parms" +} diff --git a/gamedata/_dontstarve b/gamedata/_dontstarve new file mode 100644 index 000000000..a84a0cd34 --- /dev/null +++ b/gamedata/_dontstarve @@ -0,0 +1,21 @@ +# Game Settings File +# _dontstarve +# Don't Starve Engine + +# Import default settings +fn_import_game_settings _default + +# And the settings for defaults +fn_set_game_params settings "engine" "dontstarve" +fn_set_game_params settings "game" "dontstarve" +fn_set_game_params settings "gamename" "Don't Starve" + +# These are values that the script uses, they don't get used by the srcds server directly +fn_set_game_params settings "systemdir" "\${filesdir}" +fn_set_game_params settings "executabledir" "\${filesdir}/bin" +fn_set_game_params settings "executable" "./dontstarve_dedicated_server_nullrenderer" +fn_set_game_params settings "servercfg" "settings.ini" +fn_set_game_params settings "servercfgdir" "\${HOME}/.klei/DoNotStarveTogether" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.ini" + diff --git a/gamedata/_goldsource b/gamedata/_goldsource new file mode 100644 index 000000000..2153da60d --- /dev/null +++ b/gamedata/_goldsource @@ -0,0 +1,20 @@ +# Game Settings File +# _goldsource +# Gold Source Engine + +# Import default settings +fn_import_game_settings _halflife_shared + +# The parms that start with - go first +fn_set_game_params parms_minus "ip" "--UNSET--" +fn_set_game_params parms_plus "ip" "\${ip}" + +fn_set_game_params parms_minus "clientport" "--UNSET--" +fn_set_game_params parms_plus "clientport" "\${clientport}" + +# And the settings for defaults +fn_set_game_params settings "appid" "90" +fn_set_game_params settings "defaultmap" "dm_lockdown" +fn_set_game_params settings "engine" "goldsource" +fn_set_game_params settings "executable" "./hlds_run" + diff --git a/gamedata/_gslt b/gamedata/_gslt new file mode 100644 index 000000000..55f56643b --- /dev/null +++ b/gamedata/_gslt @@ -0,0 +1,5 @@ +# Game Settings File +# Game Server Login Token Support + +fn_set_game_params settings "gslt" "--EMPTY--" "Required: Game Server Login Token. GSLT is required for running a public server. More info: http://gameservermanagers.com/gslt" +fn_set_game_params parms_plus "sv_setsteamaccount" "\${gslt}" diff --git a/gamedata/_halflife_shared b/gamedata/_halflife_shared new file mode 100644 index 000000000..0e8c3b6fb --- /dev/null +++ b/gamedata/_halflife_shared @@ -0,0 +1,29 @@ +# Game Settings File +# _halflife_shared +# Half-Life Shared Engine (Source and GoldSource) + +# Import default settings +fn_import_game_settings _default +fn_import_game_settings _parms_plusminus + +# The parms that start with - go first + +fn_set_game_params parms_minus "game" "\${game}" +fn_set_game_params parms_minus "strictportbind" "--EMPTY--" +fn_set_game_params parms_minus "ip" "\${ip}" +fn_set_game_params parms_minus "port" "\${port}" +fn_set_game_params parms_minus "maxplayers" "\${maxplayers}" +fn_set_game_params parms_minus "tickrate" "\${tickrate}" + +# Then the parms that start with + +fn_set_game_params parms_plus "clientport" "\${clientport}" +fn_set_game_params parms_plus "servercfgfile" "\${servercfg}" +fn_set_game_params parms_plus "map" "\${defaultmap}" + +# And the settings for defaults +fn_set_game_params settings "clientport" "27005" "Client Port" +fn_set_game_params settings "defaultmap" "dm_lockdown" "Default map to load" +fn_set_game_params settings "maxplayers" "64" +fn_set_game_params settings "port" "27015" +fn_set_game_params settings "server_parms" "--EMPTY--" "Additional server Parameters. Put the parameters that start with \"-\" first, then \"+\" parameters after" +fn_set_game_params settings "tickrate" "64" "Server Tick Rate" diff --git a/gamedata/_parms_plusminus b/gamedata/_parms_plusminus new file mode 100644 index 000000000..7569e86f4 --- /dev/null +++ b/gamedata/_parms_plusminus @@ -0,0 +1,10 @@ +# Game Settings File +# _parms_plusminus +# Parameter parsing with "+" and "-" sorting + +# This is the way we create a script that collates and parses the parameters +fn_parms(){ + parms_minus="$(echo $(sed -e 's/^\([^#=]\+\)=\"/\-\1 /g' -e 's/\"$//g' ${settingsdir}/parms_minus))" + parms_plus="$(echo $(sed -e 's/^\([^#=]\+\)=\"/\+\1 /g' -e 's/\"$//g' ${settingsdir}/parms_plus))" + parms="$(eval "echo \"${parms_minus} ${server_parms} ${parms_plus}\"")" +} diff --git a/gamedata/_projectzomboid b/gamedata/_projectzomboid new file mode 100644 index 000000000..e5fa49dc4 --- /dev/null +++ b/gamedata/_projectzomboid @@ -0,0 +1,18 @@ +# Game Settings File +# _projectzomboid +# Project Zomboid Engine + +# Import default settings +fn_import_game_settings _default + +# And the settings for defaults +fn_set_game_params settings "engine" "projectzomboid" + +# These are values that the script uses, they don't get used by the srcds server directly +fn_set_game_params settings "systemdir" "\${filesdir}" +fn_set_game_params settings "gamelogdir" "\${systemdir}/logs" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./start-server.sh" +fn_set_game_params settings "servercfg" "servertest.ini" +fn_set_game_params settings "servercfgdir" "\${HOME}/Zomboid/Server" + diff --git a/gamedata/_realvirtuality b/gamedata/_realvirtuality new file mode 100644 index 000000000..ec253592b --- /dev/null +++ b/gamedata/_realvirtuality @@ -0,0 +1,18 @@ +# Game Settings File +# _realvirtuality +# Real Virtuality Engine + +# Import default settings +fn_import_game_settings _default + +fn_set_game_params settings "engine" "realvirtuality" +fn_set_game_params settings "systemdir" "\${filesdir}" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./arma3server" +fn_set_game_params settings "servercfg" "\${servicename}.server.cfg" +fn_set_game_params settings "networkcfg" "\${servicename}.network.cfg" +fn_set_game_params settings "servercfgdir" "\${systemdir}/cfg" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "networkcfgfullpath" "\${servercfgdir}/\${networkcfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.server.cfg" +fn_set_game_params settings "networkcfgdefault" "\${servercfgdir}/lgsm-default.network.cfg" diff --git a/gamedata/_seriousengine35 b/gamedata/_seriousengine35 new file mode 100644 index 000000000..30d768d6b --- /dev/null +++ b/gamedata/_seriousengine35 @@ -0,0 +1,15 @@ +# Game Settings File +# _seriousengine35 +# Serious Engine 3.5 + +# Import default settings +fn_import_game_settings _default + +fn_set_game_params settings "engine" "seriousengine35" +fn_set_game_params settings "systemdir" "\${filesdir}/Bin" +fn_set_game_params settings "executable" "./runSam3_DedicatedServer.sh" +fn_set_game_params settings "executabledir" "\${systemdir}" +fn_set_game_params settings "servercfg" "\${servicename}.ini" +fn_set_game_params settings "servercfgdir" "\${filesdir}/Content/SeriousSam3/Config" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.ini" diff --git a/gamedata/_source b/gamedata/_source new file mode 100644 index 000000000..c65023e2a --- /dev/null +++ b/gamedata/_source @@ -0,0 +1,15 @@ +# Game Settings File +# _source +# Source Engine + +# Import default settings +fn_import_game_settings _halflife_shared + +# And the settings for defaults +fn_set_game_params settings "engine" "source" "Game Engine" +fn_set_game_params settings "sourcetvport" "27020" "SourceTV Port" + +fn_set_game_params parms_plus "tv_port" "\${sourcetvport}" + +# These are values that the script uses, they don't get used by the srcds server directly +fn_set_game_params settings "executable" "./srcds_linux" diff --git a/gamedata/_spark b/gamedata/_spark new file mode 100644 index 000000000..ae57b88bb --- /dev/null +++ b/gamedata/_spark @@ -0,0 +1,7 @@ +# Game Settings File +# _spark +# Spark Engine + +# Import default settings +fn_import_game_settings _default + diff --git a/gamedata/_starbound b/gamedata/_starbound new file mode 100644 index 000000000..430f35a82 --- /dev/null +++ b/gamedata/_starbound @@ -0,0 +1,13 @@ +# Game Settings File +# _srcds +# Base SRCDS Game + +# Import default settings +fn_import_game_settings _default + +fn_set_game_params settings "engine" "starbound" +fn_set_game_params settings "executabledir" "\${filesdir}/linux64" +fn_set_game_params settings "executable" "./starbound_server" +fn_set_game_params settings "servercfg" "sbboot.config" +fn_set_game_params settings "servercfgdir" "\${executabledir}" +fn_set_game_params settings "gamelogdir" "\${filesdir}/giraffe_storage" diff --git a/gamedata/_teeworlds b/gamedata/_teeworlds new file mode 100644 index 000000000..f4994b9ed --- /dev/null +++ b/gamedata/_teeworlds @@ -0,0 +1,15 @@ +# Game Settings File +# _teeworlds +# TeeWorlds Engine + +# Import default settings +fn_import_game_settings _default + +fn_set_game_params settings "engine" "teeworlds" +fn_set_game_params settings "systemdir" "\${filesdir}" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./teeworlds_srv" +fn_set_game_params settings "servercfg" "\${servicename}.cfg" # Teeworlds can also auto load any config if an autoexec.cfg file is present in the server dir +fn_set_game_params settings "servercfgdir" "\${filesdir}" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.cfg" diff --git a/gamedata/_terraria b/gamedata/_terraria new file mode 100644 index 000000000..37b11f0cb --- /dev/null +++ b/gamedata/_terraria @@ -0,0 +1,15 @@ +# Game Settings File +# _terraria +# Terarria Engine + +# Import default settings +fn_import_game_settings _default + +fn_set_game_params settings "engine" "terraria" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./TerrariaServer" +fn_set_game_params settings "servercfg" "\${servicename}.txt" +fn_set_game_params settings "servercfgdir" "\${filesdir}" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.txt" +fn_set_game_params settings "gamelogdir" "" diff --git a/gamedata/_unity3d b/gamedata/_unity3d new file mode 100644 index 000000000..cd5448fa6 --- /dev/null +++ b/gamedata/_unity3d @@ -0,0 +1,31 @@ +# Game Settings File +# _unity3d +# Unity 3D Engine + +# Import default settings +fn_import_game_settings _default + +fn_set_game_params settings "engine" "unity3d" +# http://hurtworld.wikia.com/wiki/Hosting_A_Server +fn_parms(){ +parms="-batchmode -nographics -exec \"host ${port} ${map} ${loadsave};queryport ${queryport};maxplayers ${maxplayers};servername ${servername};creativemode ${creativemode};${admins}\" -logfile \"${logfile}\" " +} +fn_set_game_params settings "port" "12871" +fn_set_game_params settings "queryport" "12881" +fn_set_game_params settings "maxplayers" "20" +fn_set_game_params settings "map" "--EMPTY--" "Optional" +fn_set_game_params settings "creativemode" "0" "Free Build" +fn_set_game_params settings "logfile" "gamelog.txt" +fn_set_game_params settings "admins" "--EMPTY--" "Adding admins using STEAMID64. Example : addadmin 012345678901234567; addadmin 987654321098765432" + +# Advanced +fn_set_game_params settings "loadsave" "" "Rollback server state (remove after start command)" +fn_set_game_params settings "x64mode" "0" "Use unstable 64 bit server executable (O/1)" +fn_set_game_params settings "filesdir" "\${rootdir}/serverfiles" +fn_set_game_params settings "systemdir" "\${filesdir}" +fn_set_game_params settings "executabledir" "\${filesdir}" +if [ "${x64mode}" == "1" ]; then + fn_set_game_params settings "executable" "./Hurtworld.x86_64" +else + fn_set_game_params settings "executable" "./Hurtworld.x86" +fi diff --git a/gamedata/_unreal b/gamedata/_unreal new file mode 100644 index 000000000..034947c7e --- /dev/null +++ b/gamedata/_unreal @@ -0,0 +1,20 @@ +# Game Settings File +# _unreal +# Unreal Engine + +# Import default settings +fn_import_game_settings _default + +# This is the way we create a script that collates and parses the parameters +fn_parms(){ + parms="" +} +fn_set_game_params settings "systemdir" "\${filesdir}/System" +fn_set_game_params settings "gamelogdir" "\${systemdir}/logs" +fn_set_game_params settings "executabledir" "\${systemdir}" +fn_set_game_params settings "executable" "./ucc-bin" +fn_set_game_params settings "servercfg" "\${servicename}.ini" +fn_set_game_params settings "servercfgdir" "\${systemdir}" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/Default.ini" +fn_set_game_params settings "compressedmapsdir" "${rootdir}/Maps-Compressed" "Compressed Maps Directory" diff --git a/gamedata/_unreal2 b/gamedata/_unreal2 new file mode 100644 index 000000000..7b289200a --- /dev/null +++ b/gamedata/_unreal2 @@ -0,0 +1,18 @@ +# Game Settings File +# _unreal2 +# Unreal 2 Engine + +# Import default settings +fn_import_game_settings _default + +fn_parms(){ + parms="" +} +fn_set_game_params settings "systemdir" "${filesdir}/System" +fn_set_game_params settings "executabledir" "${systemdir}" +fn_set_game_params settings "executable" "./ucc-bin" +fn_set_game_params settings "servercfg" "${servicename}.ini" +fn_set_game_params settings "servercfgdir" "${systemdir}" +fn_set_game_params settings "servercfgfullpath" "${servercfgdir}/${servercfg}" +fn_set_game_params settings "servercfgdefault" "${servercfgdir}/Default.ini" +fn_set_game_params settings "compressedmapsdir" "${rootdir}/Maps-Compressed" diff --git a/gamedata/_unreal4 b/gamedata/_unreal4 new file mode 100644 index 000000000..e7f01274d --- /dev/null +++ b/gamedata/_unreal4 @@ -0,0 +1,18 @@ +# Game Settings File +# _unreal4 +# Unreal 4 Engine + +# Import default settings +fn_import_game_settings _default + +fn_parms(){ + parms="" +} +fn_set_game_params settings "systemdir" "\${filesdir}/\${game}" +fn_set_game_params settings "gamelogdir" "\${systemdir}/logs" +fn_set_game_params settings "executabledir" "\${systemdir}/Binaries/Linux" +fn_set_game_params settings "executable" "./\${game}Server" +fn_set_game_params settings "servercfg" "GameUserSettings.ini" +fn_set_game_params settings "servercfgdir" "\${systemdir}/Saved/Config/LinuxServer" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.ini" diff --git a/gamedata/_workshop b/gamedata/_workshop new file mode 100644 index 000000000..f328a42fa --- /dev/null +++ b/gamedata/_workshop @@ -0,0 +1,9 @@ +# Game Settings File + +# Workshop Authentication and Settings +fn_set_game_params parms_minus "authkey" "\${authkey}" +fn_set_game_params parms_plus "host_workshop_collection" "\${host_workshop_collection}" +fn_set_game_params parms_plus "workshop_start_map" "\${workshop_start_map}" +fn_set_game_params settings "authkey" "--EMPTY--" "Optional key for Workshop Content. See https://developer.valvesoftware.com/wiki/CSGO_Workshop_For_Server_Operators - To get an authkey visit - http://steamcommunity.com/dev/apikey" +fn_set_game_params settings "host_workshop_collection" "--EMPTY--" "Workshop Collection ID" +fn_set_game_params settings "workshop_start_map" "--EMPTY--" "Workshop Start Map" diff --git a/gamedata/arkserver b/gamedata/arkserver new file mode 100644 index 000000000..302b4398c --- /dev/null +++ b/gamedata/arkserver @@ -0,0 +1,23 @@ +# Game Settings File +# +# + +# Import Engine +fn_import_game_settings _unreal4 + +fn_parms(){ +parms="TheIsland?listen" +} + +fn_set_game_params settings "appid" "376030" +fn_set_game_params settings "game" "ShooterGame" +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" +fn_set_game_params settings "executabledir" "\${systemdir}/Binaries/Linux" +fn_set_game_params settings "executable" "./\${game}Server" +fn_set_game_params settings "servercfg" "GameUserSettings.ini" +fn_set_game_params settings "servercfgdir" "\${systemdir}/Saved/Config/LinuxServer" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.ini" diff --git a/gamedata/arma3server b/gamedata/arma3server new file mode 100644 index 000000000..cfc80af3c --- /dev/null +++ b/gamedata/arma3server @@ -0,0 +1,22 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _realvirtuality + +fn_parms(){ +parms="-netlog -ip=${ip} -port=${port} -cfg=${networkcfgfullpath} -config=${servercfgfullpath} -mod=${mods} -servermod=${servermods} -bepath=${bepath} -autoinit -loadmissiontomemory" +} +fn_set_game_params settings "port" "2302" +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 "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./arma3server" +fn_set_game_params settings "servercfg" "\${servicename}.server.cfg" +fn_set_game_params settings "networkcfg" "\${servicename}.network.cfg" "Network Config" +fn_set_game_params settings "servercfgdir" "\${systemdir}/cfg" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "networkcfgfullpath" "\${servercfgdir}/\${networkcfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.server.cfg" +fn_set_game_params settings "networkcfgdefault" "\${servercfgdir}/lgsm-default.network.cfg" "Default Network Config File" diff --git a/gamedata/bb2server b/gamedata/bb2server new file mode 100644 index 000000000..3613128a0 --- /dev/null +++ b/gamedata/bb2server @@ -0,0 +1,13 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source +#fn_import_game_settings _gslt + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game brainbread2 -insecure -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "346330" +fn_set_game_params settings "gamename" "BrainBread 2" +fn_set_game_params settings "game" "brainvread2" +fn_set_game_params settings "defaultmap" "bba_barracks" diff --git a/gamedata/bmdmserver b/gamedata/bmdmserver new file mode 100644 index 000000000..77d61d67e --- /dev/null +++ b/gamedata/bmdmserver @@ -0,0 +1,11 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +fn_parms(){ +parms="-game bms -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +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" diff --git a/gamedata/bsserver b/gamedata/bsserver new file mode 100644 index 000000000..a64d7074d --- /dev/null +++ b/gamedata/bsserver @@ -0,0 +1,12 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-autoupdate -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "228780" +fn_set_game_params settings "defaultmap" "duel_winter" +fn_set_game_params settings "game" "berimbau" +fn_set_game_params settings "gamename" "Blade Symphony" diff --git a/gamedata/csczserver b/gamedata/csczserver new file mode 100644 index 000000000..d56c3f55a --- /dev/null +++ b/gamedata/csczserver @@ -0,0 +1,10 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _goldsource +fn_parms(){ +parms="-game czero -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "90" +fn_set_game_params settings "defaultmap" "de_dust2" +fn_set_game_params settings "game" "czero" +fn_set_game_params settings "gamename" "Counter Strike: Condition Zero" diff --git a/gamedata/csgoserver b/gamedata/csgoserver new file mode 100644 index 000000000..85861f20d --- /dev/null +++ b/gamedata/csgoserver @@ -0,0 +1,27 @@ +# Game Settings File +# csgoserver +# Counter-Strike: Global Offensive Dedicated Server + +# Import SRCDS +fn_import_game_settings _source +fn_import_game_settings _gslt +fn_import_game_settings _workshop + +# Override some server settings +fn_set_game_params settings "appid" "740" +fn_set_game_params settings "defaultmap" "de_dust2" +fn_set_game_params settings "game" "csgo" +fn_set_game_params settings "mapcyclefile" "--UNSET--" +fn_set_game_params settings "gamename" "Counter Strike: Global Offensive" +fn_set_game_params settings "mapgroup" "random_classic" "Map Group. See https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Dedicated_Servers#Starting_the_Server" +fn_set_game_params settings "gametype" "0" "Game Type. Set to: Arms Race 1 Classic Casual 0 Classic Competitive 0 Demolition 1 Deathmatch 1" +fn_set_game_params settings "gamemode" "0" "Game Mode. Set to: Arms Race 0 Classic Casual 0 Classic Competitive 1 Demolition 1 Deathmatch 2" + +# The parms that start with - go first +fn_set_game_params parms_minus "usercon" "--EMPTY--" +fn_set_game_params parms_minus "maxplayers_override" "\${maxplayers}" + +# Then the parms that start with + +fn_set_game_params parms_plus "mapgroup" "\${mapgroup}" +fn_set_game_params parms_plus "game_mode" "\${gamemode}" +fn_set_game_params parms_plus "game_type" "\${gametype}" diff --git a/gamedata/csserver b/gamedata/csserver new file mode 100644 index 000000000..f0078b07f --- /dev/null +++ b/gamedata/csserver @@ -0,0 +1,14 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _goldsource + +#TODO +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2 +fn_parms(){ +parms="-game cstrike -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}" +} +# Steam +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" diff --git a/gamedata/cssserver b/gamedata/cssserver new file mode 100644 index 000000000..3ee0309de --- /dev/null +++ b/gamedata/cssserver @@ -0,0 +1,17 @@ +# Game Settings File +# cssserver +# Counter-Strike: Source Dedicated Server + +# Import SRCDS +fn_import_game_settings _source + +# Override some server settings +fn_parms(){ +parms="-game cstrike -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} + +fn_set_game_params settings "appid" "232330" +fn_set_game_params settings "defaultmap" "de_dust2" +fn_set_game_params settings "game" "cstrike" +fn_set_game_params settings "mapcyclefile" "--UNSET--" +fn_set_game_params settings "gamename" "Counter Strike: Source" diff --git a/gamedata/dabserver b/gamedata/dabserver new file mode 100644 index 000000000..856f70b4f --- /dev/null +++ b/gamedata/dabserver @@ -0,0 +1,14 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "317800" +fn_set_game_params settings "defaultmap" "da_rooftops" +fn_set_game_params settings "executable" "./dabds.sh" +fn_set_game_params settings "game" "dab" +fn_set_game_params settings "gamename" "Double Action: Boogaloo" +fn_set_game_params settings "maxplayers" "10" diff --git a/gamedata/dmcserver b/gamedata/dmcserver new file mode 100644 index 000000000..fcda20f33 --- /dev/null +++ b/gamedata/dmcserver @@ -0,0 +1,14 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _goldsource + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2 +fn_parms(){ +parms="-game dmc -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}" +} + +# Steam +fn_set_game_params settings "appid" "90" +fn_set_game_params settings "defaultmap" "dcdm5" +fn_set_game_params settings "game" "dmc" +fn_set_game_params settings "gamename" "Deathmatch Classic" diff --git a/gamedata/dodserver b/gamedata/dodserver new file mode 100644 index 000000000..0c701b00a --- /dev/null +++ b/gamedata/dodserver @@ -0,0 +1,12 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _goldsource + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2 +fn_parms(){ +parms="-game dod -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}" +} +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" diff --git a/gamedata/dodsserver b/gamedata/dodsserver new file mode 100644 index 000000000..643842a2c --- /dev/null +++ b/gamedata/dodsserver @@ -0,0 +1,12 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game dod -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +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" diff --git a/gamedata/dstserver b/gamedata/dstserver new file mode 100644 index 000000000..9278878ef --- /dev/null +++ b/gamedata/dstserver @@ -0,0 +1,11 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _dontstarve + +#http://dont-starve-game.wikia.com/wiki/Guides/Don%E2%80%99t_Starve_Together_Dedicated_Servers +fn_parms(){ +parms="" +} +fn_set_game_params settings "appid" "343050" +fn_set_game_params settings "game" "dontstarve" +fn_set_game_params settings "gamename" "Don't Starve Together" diff --git a/gamedata/fofserver b/gamedata/fofserver new file mode 100644 index 000000000..6a06150b4 --- /dev/null +++ b/gamedata/fofserver @@ -0,0 +1,12 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game fof -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +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" diff --git a/gamedata/gesserver b/gamedata/gesserver new file mode 100644 index 000000000..ad7f14092 --- /dev/null +++ b/gamedata/gesserver @@ -0,0 +1,13 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game gesource -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} + +fn_set_game_params settings "appid" "310" +fn_set_game_params settings "defaultmap" "ge_archives" +fn_set_game_params settings "game" "gesource" +fn_set_game_params settings "gamename" "GoldenEye: Source" diff --git a/gamedata/gmodserver b/gamedata/gmodserver new file mode 100644 index 000000000..60d37ff02 --- /dev/null +++ b/gamedata/gmodserver @@ -0,0 +1,20 @@ +# Game Settings File +# gmodserver +# Garry's Mod Server + +# Import SRCDS +fn_import_game_settings _source +fn_import_game_settings _gslt +fn_import_game_settings _workshop + +# Override some server settings +fn_set_game_params settings "appid" "4020" +fn_set_game_params settings "defaultmap" "gm_construct" +fn_set_game_params settings "game" "garrysmod" +fn_set_game_params settings "mapcyclefile" "--UNSET--" +fn_set_game_params settings "gamename" "Garry's Mod" +fn_set_game_params settings "gamemode" "sandbox" "Game Mode." + +# Add the command line parameters +fn_set_game_params parms_plus "mapgroup" "\${mapgroup}" +fn_set_game_params parms_plus "gamemode" "\${gamemode}" diff --git a/gamedata/hl2dmserver b/gamedata/hl2dmserver new file mode 100644 index 000000000..e686e8d75 --- /dev/null +++ b/gamedata/hl2dmserver @@ -0,0 +1,12 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game hl2mp -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "232370" +fn_set_game_params settings "defaultmap" "dm_lockdown" +fn_set_game_params settings "game" "hl2mp" +fn_set_game_params settings "gamename" "Half Life 2: Deathmatch" diff --git a/gamedata/hldmserver b/gamedata/hldmserver new file mode 100644 index 000000000..947d7783a --- /dev/null +++ b/gamedata/hldmserver @@ -0,0 +1,13 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _goldsource + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2 +fn_parms(){ +parms="-game valve -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}" +} + +fn_set_game_params settings "appid" "90" +fn_set_game_params settings "defaultmap" "crossfire" +fn_set_game_params settings "game" "valve" +fn_set_game_params settings "gamename" "Half Life: Deathmatch" diff --git a/gamedata/hldmsserver b/gamedata/hldmsserver new file mode 100644 index 000000000..bf200dcfc --- /dev/null +++ b/gamedata/hldmsserver @@ -0,0 +1,14 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game hl1mp -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +# Steam +fn_set_game_params settings "appid" "255470" +fn_set_game_params settings "defaultmap" "crossfire" +fn_set_game_params settings "game" "hl1mp" +fn_set_game_params settings "gamename" "Half-Life Deathmatch: Source" + diff --git a/gamedata/hwserver b/gamedata/hwserver new file mode 100644 index 000000000..06b668dbf --- /dev/null +++ b/gamedata/hwserver @@ -0,0 +1,31 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _unity3d + + +# http://hurtworld.wikia.com/wiki/Hosting_A_Server +fn_parms(){ +parms="-batchmode -nographics -exec \"host ${port} ${map} ${loadsave};queryport ${queryport};maxplayers ${maxplayers};servername ${servername};creativemode ${creativemode};${admins}\" -logfile \"${logfile}\" " +} + +fn_set_game_params settings "servername" "Hurtworld LGSM Server" +fn_set_game_params settings "appid" "405100" +fn_set_game_params settings "gamename" "Hurtworld" +fn_set_game_params settings "port" "12871" +fn_set_game_params settings "queryport" "12881" "Query Port" +fn_set_game_params settings "maxplayers" "20" +fn_set_game_params settings "map" "--EMPTY--" "Optional" +fn_set_game_params settings "creativemode" "0" "Free Build" +fn_set_game_params settings "logfile" "gamelog.txt" +fn_set_game_params settings "admins" "--EMPTY--" "Adding admins using STEAMID64. Example : addadmin 012345678901234567; addadmin 987654321098765432" + +fn_set_game_params settings "loadsave" "--EMPTY--" "Rollback server state (remove after start command)" +fn_set_game_params settings "x64mode" "0" "Use unstable 64 bit server executable (O/1)" +fn_set_game_params settings "filesdir" "${rootdir}/serverfiles" +fn_set_game_params settings "systemdir" "${filesdir}" +fn_set_game_params settings "executabledir" "${filesdir}" +if [ "${x64mode}" == "1" ]; then + fn_set_game_params settings "executable" "./Hurtworld.x86_64" +else + fn_set_game_params settings "executable" "./Hurtworld.x86" +fi diff --git a/gamedata/insserver b/gamedata/insserver new file mode 100644 index 000000000..25a080ea9 --- /dev/null +++ b/gamedata/insserver @@ -0,0 +1,20 @@ +# Game Settings File +# insserver +# Insurgency Dedicated Server + +# Import Source Engine +fn_import_game_settings _source + +# Override some server settings +fn_set_game_params settings "appid" "237410" +fn_set_game_params settings "defaultmap" "ministry checkpoint" +fn_set_game_params settings "game" "insurgency" +fn_set_game_params settings "gamename" "Insurgency" + +# Add playlist parameter +fn_set_game_params parms_plus "sv_playlist" "\${playlist}" +fn_set_game_params settings "playlist" "custom" "Server Playlist" + +# Mapcycle +fn_set_game_params params_plus "mapcyclefile" "\${mapcyclefile}" +fn_set_game_params settings "mapcyclefile" "mapcycle_cooperative.txt" "Mapcycle File" diff --git a/gamedata/jc2server b/gamedata/jc2server new file mode 100644 index 000000000..a808abfe9 --- /dev/null +++ b/gamedata/jc2server @@ -0,0 +1,10 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _avalanche + +fn_parms(){ +parms="" +} + +fn_set_game_params settings "appid" "261140" +fn_set_game_params settings "gamename" "Just Cause 2" diff --git a/gamedata/kfserver b/gamedata/kfserver new file mode 100644 index 000000000..48b709de6 --- /dev/null +++ b/gamedata/kfserver @@ -0,0 +1,15 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _unreal2 + +fn_parms(){ +parms="server ${defaultmap}?game=KFmod.KFGameType?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}" + +# Start Variables for Objective mode +#defaultmap="KFO-Steamland" +#parms="server ${defaultmap}?Game=KFStoryGame.KFStoryGame?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}" +} + +fn_set_game_params settings "appid" "215360" +fn_set_game_params settings "defaultmap" "KF-BioticsLab.rom" +fn_set_game_params settings "gamename" "Killing Floor" diff --git a/gamedata/l4d2server b/gamedata/l4d2server new file mode 100644 index 000000000..02f91c8a3 --- /dev/null +++ b/gamedata/l4d2server @@ -0,0 +1,13 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game left4dead2 -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "222860" +fn_set_game_params settings "defaultmap" "c5m1_waterfront" +fn_set_game_params settings "game" "left4dead2" +fn_set_game_params settings "gamename" "Left 4 Dead 2" +fn_set_game_params settings "maxplayers" "8" diff --git a/gamedata/l4dserver b/gamedata/l4dserver new file mode 100644 index 000000000..67d7498af --- /dev/null +++ b/gamedata/l4dserver @@ -0,0 +1,14 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game left4dead -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} -tickrate ${tickrate} +map ${defaultmap} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "222840" +fn_set_game_params settings "defaultmap" "l4d_hospital01_apartment" +fn_set_game_params settings "game" "left4dead" +fn_set_game_params settings "gamename" "Left 4 Dead" +fn_set_game_params settings "maxplayers" "8" diff --git a/gamedata/nmrihserver b/gamedata/nmrihserver new file mode 100644 index 000000000..c7a5c8dd4 --- /dev/null +++ b/gamedata/nmrihserver @@ -0,0 +1,13 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game nmrih -insecure -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +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 "maxplayers" "8" diff --git a/gamedata/ns2cserver b/gamedata/ns2cserver new file mode 100644 index 000000000..5b830de5b --- /dev/null +++ b/gamedata/ns2cserver @@ -0,0 +1,22 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _spark + +fn_parms(){ +parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${rootdir}/${configpath}\" -modstorage \"${rootdir}/${modstorage}\" -mods \"${mods}\"" +} + +fn_set_game_params settings "appid" "313900" +fn_set_game_params settings "configpath" "server1" +fn_set_game_params settings "defaultmap" "co_core" +fn_set_game_params settings "executable" "./ns2combatserver_linux32" +fn_set_game_params settings "executabledir" "\${filesdir}/ia32" +fn_set_game_params settings "gamename" "NS2: Combat" +fn_set_game_params settings "maxplayers" "24" +fn_set_game_params settings "mods" "--EMPTY--" +fn_set_game_params settings "modstorage" "server1/Workshop" +fn_set_game_params settings "password" "-EMPTY--" +fn_set_game_params settings "servername" "NS2C Server" +fn_set_game_params settings "webadminuser" "admin" +fn_set_game_params settings "webadminpass" "admin" +fn_set_game_params settings "webadminport" "8080" diff --git a/gamedata/ns2server b/gamedata/ns2server new file mode 100644 index 000000000..174cb8e84 --- /dev/null +++ b/gamedata/ns2server @@ -0,0 +1,24 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _spark + +# http://wiki.unknownworlds.com/ns2/Dedicated_Server +fn_parms(){ +parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${rootdir}/${configpath}\" -modstorage \"${rootdir}/${modstorage}\" -mods \"${mods}\"" +} + +fn_set_game_params settings "defaultmap" "ns2_summit" +fn_set_game_params settings "maxplayers" "24" +fn_set_game_params settings "servername" "NS2 Server" +fn_set_game_params settings "webadminuser" "admin" +fn_set_game_params settings "webadminpass" "admin" +fn_set_game_params settings "webadminport" "8080" +fn_set_game_params settings "configpath" "server1" +fn_set_game_params settings "modstorage" "server1/Workshop" +fn_set_game_params settings "mods" "" +fn_set_game_params settings "password" "" +fn_set_game_params settings "appid" "4940" +fn_set_game_params settings "gamename" "Natural Selection 2" +fn_set_game_params settings "systemdir" "${filesdir}" +fn_set_game_params settings "executabledir" "${filesdir}" +fn_set_game_params settings "executable" "./server_linux32" diff --git a/gamedata/opforserver b/gamedata/opforserver new file mode 100644 index 000000000..026cbd91d --- /dev/null +++ b/gamedata/opforserver @@ -0,0 +1,13 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _goldsource + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2 +fn_parms(){ +parms="-game gearbox -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}" +} +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" "Opposing Force" +fn_set_game_params settings "maxplayers" "16" diff --git a/gamedata/pvkiiserver b/gamedata/pvkiiserver new file mode 100644 index 000000000..9df069bda --- /dev/null +++ b/gamedata/pvkiiserver @@ -0,0 +1,12 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source + +fn_parms(){ +parms="-game pvkii -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "17575" +fn_set_game_params settings "gamename" "Pirates, Vikings, and Knights II" +fn_set_game_params settings "defaultmap" "bt_island" +fn_set_game_params settings "maxplayers" "24" +fn_set_game_params settings "game" "pvkii" diff --git a/gamedata/pzserver b/gamedata/pzserver new file mode 100644 index 000000000..da6702d43 --- /dev/null +++ b/gamedata/pzserver @@ -0,0 +1,17 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _projectzomboid + + +fn_parms(){ +parms="" +} +fn_set_game_params settings "appid" "380870" +fn_set_game_params settings "gamename" "Project Zomboid" + +fn_set_game_params settings "systemdir" "\${filesdir}" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./start-server.sh" +fn_set_game_params settings "servercfg" "servertest.ini" +fn_set_game_params settings "servercfgdir" "\${HOME}/Zomboid/Server" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" diff --git a/gamedata/ricochetserver b/gamedata/ricochetserver new file mode 100644 index 000000000..ce2c6a38f --- /dev/null +++ b/gamedata/ricochetserver @@ -0,0 +1,12 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _goldsource + +fn_parms(){ +parms="-game ricochet -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "90" +fn_set_game_params settings "defaultmap" "rc_arena" +fn_set_game_params settings "maxplayers" "16" +fn_set_game_params settings "gamename" "Ricochet" +fn_set_game_params settings "game" "ricochet" diff --git a/gamedata/roserver b/gamedata/roserver new file mode 100644 index 000000000..f8cbe9863 --- /dev/null +++ b/gamedata/roserver @@ -0,0 +1,15 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _unreal2 + +fn_parms(){ +parms="server ${defaultmap}?game=ROGame.ROTeamGame?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}" +} + +fn_set_game_params settings "gamename" "Red Orchestra" +fn_set_game_params settings "appid" "223250" +fn_set_game_params settings "defaultmap" "RO-Arad.rom" + +# Lower Case wtf? +fn_set_game_params settings "systemdir" "${filesdir}/system" +fn_set_game_params settings "servercfgdefault" "${servercfgdir}/default.ini" diff --git a/gamedata/sbserver b/gamedata/sbserver new file mode 100644 index 000000000..a7655161a --- /dev/null +++ b/gamedata/sbserver @@ -0,0 +1,15 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _starbound + +fn_parms(){ +parms="" +} +fn_set_game_params settings "appid" "211820" +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" +fn_set_game_params settings "servercfg" "sbboot.config" +fn_set_game_params settings "servercfgdir" "${executabledir}" +fn_set_game_params settings "gamelogdir" "${filesdir}/giraffe_storage" diff --git a/gamedata/sdtdserver b/gamedata/sdtdserver new file mode 100644 index 000000000..d357c8911 --- /dev/null +++ b/gamedata/sdtdserver @@ -0,0 +1,18 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _unity3d + +# http://7daystodie.gamepedia.com/Server +fn_parms(){ +parms="-configfile=${servercfgfullpath} -dedicated" +} + +fn_set_game_params settings "appid" "294420" +fn_set_game_params settings "gamename" "7 Days To Die" +fn_set_game_params settings "executable" "./startserver.sh" +fn_set_game_params settings "servercfg" "${servicename}.xml" +fn_set_game_params settings "servercfgdir" "${filesdir}" +fn_set_game_params settings "servercfgfullpath" "${servercfgdir}/${servercfg}" +fn_set_game_params settings "servercfgdefault" "${servercfgdir}/serverconfig.xml" + + diff --git a/gamedata/ss3sserver b/gamedata/ss3sserver new file mode 100644 index 000000000..a88ab44e2 --- /dev/null +++ b/gamedata/ss3sserver @@ -0,0 +1,18 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _seriousengine35 + +# https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/SeriousSam3BFE/help/DedicatedServer_Readme.txt +fn_parms(){ +parms="+ip ${ip} +logfile ${gamelog} +exec ${servercfgfullpath}" +} + +fn_set_game_params settings "appid" "41080" +fn_set_game_params settings "gamename" "Serious Sam 3: BFE" +fn_set_game_params settings "systemdir" "\${filesdir}/Bin" +fn_set_game_params settings "executable" "./runSam3_DedicatedServer.sh" +fn_set_game_params settings "executabledir" "\${systemdir}" +fn_set_game_params settings "servercfg" "\${servicename}.ini" +fn_set_game_params settings "servercfgdir" "\${filesdir}/Content/SeriousSam3/Config" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.ini" diff --git a/gamedata/terrariaserver b/gamedata/terrariaserver new file mode 100644 index 000000000..d2911ff20 --- /dev/null +++ b/gamedata/terrariaserver @@ -0,0 +1,17 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _terarria + +fn_parms(){ +parms="-config ${servercfgfullpath}" +} +fn_set_game_params settings "appid" "105600" +fn_set_game_params settings "gamename" "Terraria" +fn_set_game_params settings "game" "terraria" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./TerrariaServer" +fn_set_game_params settings "servercfg" "\${servicename}.txt" +fn_set_game_params settings "servercfgdir" "\${filesdir}" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.txt" +fn_set_game_params settings "gamelogdir" "" "Terraria Doesn't Have a Server Log" diff --git a/gamedata/tf2server b/gamedata/tf2server new file mode 100644 index 000000000..949cab05c --- /dev/null +++ b/gamedata/tf2server @@ -0,0 +1,14 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _source +fn_import_game_settings _gslt + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server +fn_parms(){ +parms="-game tf -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +sv_setsteamaccount ${gslt} +servercfgfile ${servercfg} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "232250" +fn_set_game_params settings "gamename" "Team Fortress 2" +fn_set_game_params settings "defaultmap" "cp_badlands" +fn_set_game_params settings "maxplayers" "16" +fn_set_game_params settings "game" "tf" diff --git a/gamedata/tfcserver b/gamedata/tfcserver new file mode 100644 index 000000000..0f516692a --- /dev/null +++ b/gamedata/tfcserver @@ -0,0 +1,13 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _goldsource + +# https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2 +fn_parms(){ +parms="-game tfc -strictportbind _ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}" +} +fn_set_game_params settings "appid" "90" +fn_set_game_params settings "gamename" "Team Fortress Classic" +fn_set_game_params settings "defaultmap" "dustbowl" +fn_set_game_params settings "maxplayers" "16" +fn_set_game_params settings "game" "tfc" diff --git a/gamedata/twserver b/gamedata/twserver new file mode 100644 index 000000000..fed412727 --- /dev/null +++ b/gamedata/twserver @@ -0,0 +1,18 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _teeworlds + +fn_parms(){ +parms="-f ${servercfgfullpath}" +} + +fn_set_game_params settings "appid" "380840" +fn_set_game_params settings "gamename" "Teeworlds" +fn_set_game_params settings "game" "teeworlds" +fn_set_game_params settings "systemdir" "\${filesdir}" +fn_set_game_params settings "executabledir" "\${filesdir}" +fn_set_game_params settings "executable" "./teeworlds_srv" +fn_set_game_params settings "servercfg" "\${servicename}.cfg" +fn_set_game_params settings "servercfgdir" "\${filesdir}" +fn_set_game_params settings "servercfgfullpath" "\${servercfgdir}/\${servercfg}" +fn_set_game_params settings "servercfgdefault" "\${servercfgdir}/lgsm-default.cfg" diff --git a/gamedata/ut2k4server b/gamedata/ut2k4server new file mode 100644 index 000000000..f5aab6d53 --- /dev/null +++ b/gamedata/ut2k4server @@ -0,0 +1,12 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _unreal2 + +fn_parms(){ +parms="server ${defaultmap}?game=XGame.xDeathMatch -nohomedir ini=${servercfg} log=${gamelog}" +} +fn_set_game_params settings "gamename" "Unreal Tournament 2004" +fn_set_game_params settings "defaultmap" "DM-Rankin" + +# Why isn't this Default? +fn_set_game_params settings "servercfgdefault" "${servercfgdir}/UT2004.ini" diff --git a/gamedata/ut99server b/gamedata/ut99server new file mode 100644 index 000000000..2a9eeb93b --- /dev/null +++ b/gamedata/ut99server @@ -0,0 +1,10 @@ +# Game Settings File +# Import Engine +fn_import_game_settings _unreal + +fn_parms(){ +parms="server ${defaultmap}.unr ini=${servercfgfullpath}" +} +fn_set_game_params settings "gamename" "Unreal Tournament 99" +fn_set_game_params settings "defaultmap" "DM-Deck16][" +