feat: Refactor comments to follow standards (#2389)

This commit is contained in:
Daniel Gibbs 2019-06-13 19:36:32 +01:00 committed by GitHub
parent 5901f19d07
commit e0acffad80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 962 additions and 875 deletions

View File

@ -93,10 +93,10 @@ elif [ "${alert}" == "config" ]; then
fn_alert_config
fi
# Generate alert log
# Generate alert log.
fn_alert_log
# Generates the more info link
# Generates the more info link.
if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then
alertflag=1
command_postdetails.sh

View File

@ -10,12 +10,12 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_print_dots "Sending Pushover alert"
# Different alerts are given different priorities and notification sounds
# Different alerts are given different priorities and notification sounds.
if [ "${alertsound}" == "1" ]; then
alertsound=""
alertpriority="0"
elif [ "${alertsound}" == "2" ]; then
# restarted
# restarted.
alertsound="siren"
alertpriority="1"
else

View File

@ -7,8 +7,8 @@
local commandname="CHECK"
# Every command that requires checks just references check.sh
# check.sh selects which checks to run by using arrays
# Every command that requires checks just references check.sh.
# check.sh selects which checks to run by using arrays.
if [ "${userinput}" != "install" ]&&[ "${userinput}" != "auto-install" ]&&[ "${userinput}" != "i" ]&&[ "${userinput}" != "ai" ]; then
check_root.sh

View File

@ -102,7 +102,7 @@ fn_install_mono_repo(){
}
fn_install_universe_repo(){
# Defensive coding - As this is an ubuntu only issue then check to make sure this fix is needed, and we are using ubuntu
# Defensive coding - As this is an ubuntu only issue then check to make sure this fix is needed, and we are using ubuntu.
if [ "${jquniversemissing}" != "0" ]&&[ "${distroid}" == "ubuntu" ]; then
fn_print_warning_nl "Ubuntu 18.04.1 contains a bug which means the sources.list file does not populate with the Ubuntu universe repository."
fn_print_information_nl "Attempting to add Universe Repo"
@ -138,7 +138,7 @@ fn_install_universe_repo(){
}
fn_deps_detector(){
# Checks if dependency is missing
# Checks if dependency is missing.
if [ "${tmuxcheck}" == "1" ]; then
# Added for users compiling tmux from source to bypass check.
depstatus=0
@ -152,16 +152,16 @@ fn_deps_detector(){
elif [ "${deptocheck}" == "jq" ]&&[ "${distroversion}" == "6" ]; then
jqstatus=1
elif [ "${deptocheck}" == "jq" ]&&[ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "18.04" ]&& ! grep -qE "^deb .*universe" /etc/apt/sources.list; then
#1985 ubuntu 18.04.1 bug does not set sources.list correctly which means universe is not active by default
#If the universe repo does not exist, mark as dependency missing and universe missing
# #1985 ubuntu 18.04.1 bug does not set sources.list correctly which means universe is not active by default
# If the universe repo does not exist, mark as dependency missing and universe missing.
depstatus=1
jquniversemissing=1
elif [ "${deptocheck}" == "mono-complete" ]; then
if [ "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then
# Mono >= 5.0.0 already installed
# Mono >= 5.0.0 already installed.
depstatus=0
else
# Mono not installed or installed Mono < 5.0.0
# Mono not installed or installed Mono < 5.0.0.
depstatus=1
monostatus=1
fi
@ -174,20 +174,20 @@ fn_deps_detector(){
fi
if [ "${depstatus}" == "0" ]; then
# if dependency is found
# If dependency is found.
missingdep=0
if [ "${function_selfname}" == "command_install.sh" ]; then
echo -e "${green}${deptocheck}${default}"
fn_sleep_time
fi
else
# if dependency is not found
# If dependency is not found.
missingdep=1
if [ "${function_selfname}" == "command_install.sh" ]; then
echo -e "${red}${deptocheck}${default}"
fn_sleep_time
fi
# Define required dependencies for SteamCMD
# Define required dependencies for SteamCMD.
if [ -n "${appid}" ]; then
if [ "${deptocheck}" == "glibc.i686" ]||[ "${deptocheck}" == "libstdc++64.i686" ]||[ "${deptocheck}" == "lib32gcc1" ]||[ "${deptocheck}" == "libstdc++6:i386" ]; then
steamcmdfail=1
@ -195,14 +195,14 @@ fn_deps_detector(){
fi
fi
# Missing dependencies are added to array_deps_missing
# Missing dependencies are added to array_deps_missing.
if [ "${missingdep}" == "1" ]; then
array_deps_missing+=("${deptocheck}")
fi
}
fn_deps_email(){
# Adds postfix to required dependencies if email alert is enabled
# Adds postfix to required dependencies if email alert is enabled.
if [ "${emailalert}" == "on" ]; then
if [ -f /usr/bin/mailx ]; then
if [ -d /etc/exim4 ]; then
@ -316,25 +316,25 @@ fn_found_missing_deps(){
}
fn_check_loop(){
# Loop though required depenencies
# Loop though required depenencies.
for deptocheck in "${array_deps_required[@]}"
do
fn_deps_detector
done
# user to be informed of any missing dependencies
# user to be informed of any missing dependencies.
fn_found_missing_deps
}
# Generate require dependencies for debian based systems
# Generate require dependencies for debian based systems.
fn_deps_build_debian(){
# Generate array of missing deps
# Generate array of missing deps.
array_deps_missing=()
## LinuxGSM requirements
# LinuxGSM requirements.
array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip binutils bc jq )
# All servers except ts3 require tmux
# All servers except ts3 require tmux.
if [ "${shortname}" != "ts3" ]; then
if [ "$(command -v tmux 2>/dev/null)" ]; then
tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
@ -343,7 +343,7 @@ fn_deps_build_debian(){
fi
fi
# All servers except ts3, mumble, GTA and minecraft servers require libstdc++6 and lib32gcc1
# All servers except ts3, mumble, GTA and minecraft servers require libstdc++6 and lib32gcc1.
if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
if [ "${arch}" == "x86_64" ]; then
array_deps_required+=( lib32gcc1 libstdc++6:i386 )
@ -352,9 +352,9 @@ fn_deps_build_debian(){
fi
fi
## Game Specific requirements
# Game Specific requirements.
# Natural Selection 2 - x64 only
# Natural Selection 2 - x64 only.
if [ "${shortname}" == "ns2" ]; then
array_deps_required+=( speex libtbb2 )
# NS2: Combat
@ -392,14 +392,16 @@ fn_deps_build_debian(){
elif [ "${shortname}" == "mc" ]; then
javaversion=$(java -version 2>&1 | grep "version")
if [ "${javaversion}" ]; then
javacheck=1 # Added for users using Oracle JRE to bypass the check.
# Added for users using Oracle JRE to bypass the check.
javacheck=1
else
array_deps_required+=( openjdk-8-jre-headless )
fi
# Project Zomboid
elif [ "${shortname}" == "pz" ]; then
if [ -n "$(java -version 2>&1 | grep "version")" ]; then
javacheck=1 # Added for users using Oracle JRE to bypass the check.
# Added for users using Oracle JRE to bypass the check.
javacheck=1
array_deps_required+=( rng-tools )
else
array_deps_required+=( default-jre rng-tools )
@ -415,10 +417,10 @@ fn_deps_build_debian(){
array_deps_required+=( libssl1.0.0:i386 zlib1g:i386 )
# Unreal Engine
elif [ "${executable}" == "./ucc-bin" ]; then
#UT2K4
# UT2K4
if [ -f "${executabledir}/ut2004-bin" ]; then
array_deps_required+=( libsdl1.2debian libstdc++5:i386 )
#UT99
# UT99
else
array_deps_required+=( libsdl1.2debian )
fi
@ -437,11 +439,11 @@ fn_deps_build_debian(){
}
fn_deps_build_redhat(){
# Generate array of missing deps
# Generate array of missing deps.
array_deps_missing=()
# LinuxGSM requirements
## CentOS 6
# LinuxGSM requirements.
# CentOS 6
if [ "${distroversion}" == "6" ]; then
array_deps_required=( epel-release curl wget util-linux-ng python file gzip bzip2 unzip binutils bc jq )
elif [ "${distroversion}" == "7" ]; then
@ -454,16 +456,17 @@ fn_deps_build_redhat(){
array_deps_required=( curl wget util-linux python file gzip bzip2 unzip binutils bc jq )
fi
# All servers except ts3 require tmux
# All servers except ts3 require tmux.
if [ "${shortname}" != "ts3" ]; then
if [ "$(command -v tmux 2>/dev/null)" ]; then
tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
# Added for users compiling tmux from source to bypass check.
tmuxcheck=1
else
array_deps_required+=( tmux )
fi
fi
# All servers except ts3,mumble,multitheftauto and minecraft servers require glibc.i686 and libstdc++.i686
# All servers except ts3, mumble, multi theft auto and minecraft servers require glibc.i686 and libstdc++.i686.
if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
if [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then
array_deps_required+=( glibc.i686 libstdc++64.i686 )
@ -472,7 +475,7 @@ fn_deps_build_redhat(){
fi
fi
# Game Specific requirements
# Game Specific requirements.
# Natural Selection 2 (x64 only)
if [ "${shortname}" == "ns2" ]; then
@ -507,7 +510,8 @@ fn_deps_build_redhat(){
elif [ "${shortname}" == "mc" ]; then
javaversion=$(java -version 2>&1 | grep "version")
if [ "${javaversion}" ]; then
javacheck=1 # Added for users using Oracle JRE to bypass the check.
# Added for users using Oracle JRE to bypass the check.
javacheck=1
array_deps_required+=( rng-tools )
else
array_deps_required+=( java-1.8.0-openjdk rng-tools )
@ -516,7 +520,8 @@ fn_deps_build_redhat(){
elif [ "${shortname}" == "pz" ]; then
javaversion=$(java -version 2>&1 | grep "version")
if [ "${javaversion}" ]; then
javacheck=1 # Added for users using Oracle JRE to bypass the check.
# Added for users using Oracle JRE to bypass the check.
javacheck=1
array_deps_required+=( rng-tools )
else
array_deps_required+=( java-1.8.0-openjdk rng-tools )
@ -559,7 +564,7 @@ if [ "${function_selfname}" == "command_install.sh" ]; then
fi
fi
# Filter checking in to Debian or Red Hat Based
# Filter checking in to Debian or Red Hat Based.
info_distro.sh
if [ -f "/etc/debian_version" ]; then
fn_deps_build_debian

View File

@ -18,10 +18,10 @@ if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${travistest}
info_config.sh
info_parms.sh
# IP is not set to specific IP
# IP is not set to specific IP.
if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
fn_print_dots "Check IP"
# Multiple interfaces
# Multiple interfaces.
if [ "${getipwc}" -ge "2" ]; then
if [ "${function_selfname}" == "command_details.sh" ]; then
fn_print_warn "Check IP: Multiple IP addresses found."
@ -29,7 +29,7 @@ if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${travistest}
fn_print_fail "Check IP: Multiple IP addresses found."
fi
echo -en "\n"
# IP is set within game config
# IP is set within game config.
if [ "${ipsetinconfig}" == "1" ]; then
fn_print_information "Specify the IP you want to bind within ${servercfg}.\n"
echo -en " * location: ${servercfgfullpath}\n"
@ -37,7 +37,7 @@ if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${travistest}
echo -en "Set ${ipinconfigvar} to one of the following:\n"
fn_script_log_fatal "Multiple IP addresses found."
fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}."
# IP is set within LinuxGSM config
# IP is set within LinuxGSM config.
else
fn_print_information_nl "Specify the IP you want to bind within a LinuxGSM config file.\n"
echo -en " * location: ${configdirserver}\n"
@ -54,14 +54,14 @@ if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${travistest}
echo -en "\n"
echo -en "https://linuxgsm.com/network-interfaces\n"
echo -en ""
# Do not exit for details and postdetails commands
# Do not exit for details and postdetails commands.
if [ "${function_selfname}" != "command_details.sh" ]||[ "${function_selfname}" != "command_postdetails.sh" ]; then
fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
core_exit.sh
else
ip="NOT SET"
fi
# Single interface
# Single interface.
elif [ "${ipsetinconfig}" == "1" ]; then
fn_print_fail "Check IP: IP address not set in game config."
echo -en "\n"

View File

@ -14,13 +14,13 @@ fn_check_logs(){
install_logs.sh
}
# Create directories for the script and console logs
# Create directories for the script and console logs.
if [ ! -d "${lgsmlogdir}" ]||[ ! -d "${consolelogdir}" ]&&[ "${shortname}" != "ts3" ]; then
fn_check_logs
fi
# Create gamelogdir
# If variable exists gamelogdir exists and log/server does not
# Create gamelogdir.
# If variable exists gamelogdir exists and log/server does not.
if [ -n "${gamelogdir}" ]&&[ -d "${gamelogdir}" ]&&[ ! -d "${logdir}/server" ]; then
fn_check_logs
fi

View File

@ -71,11 +71,11 @@ fn_check_permissions(){
fi
fi
# Check rootdir permissions
# Check rootdir permissions.
if [ -n "${rootdir}" ]; then
# Get permission numbers on directory under the form 775
# Get permission numbers on directory under the form 775.
rootdirperm="$(stat -c %a "${rootdir}")"
# Grab the first and second digit for user and group permission
# Grab the first and second digit for user and group permission.
userrootdirperm="${rootdirperm:0:1}"
grouprootdirperm="${rootdirperm:1:1}"
if [ "${userrootdirperm}" != "7" ]&&[ "${grouprootdirperm}" != "7" ]; then
@ -92,20 +92,20 @@ fn_check_permissions(){
core_exit.sh
fi
fi
# Check if executable is executable and attempt to fix it
# First get executable name
# Check if executable is executable and attempt to fix it.
# First get executable name.
execname="$(basename "${executable}")"
if [ -f "${executabledir}/${execname}" ]; then
# Get permission numbers on file under the form 775
# Get permission numbers on file under the form 775.
execperm="$(stat -c %a "${executabledir}/${execname}")"
# Grab the first and second digit for user and group permission
# Grab the first and second digit for user and group permission.
userexecperm="${execperm:0:1}"
groupexecperm="${execperm:1:1}"
# Check for invalid user permission
# Check for invalid user permission.
if [ "${userexecperm}" == "0" ]||[ "${userexecperm}" == "2" ]||[ "${userexecperm}" == "4" ]||[ "${userexecperm}" == "6" ]; then
# If user permission is invalid, then check for invalid group permissions
# If user permission is invalid, then check for invalid group permissions.
if [ "${groupexecperm}" == "0" ]||[ "${groupexecperm}" == "2" ]||[ "${groupexecperm}" == "4" ]||[ "${groupexecperm}" == "6" ]; then
# If permission issues are found
# If permission issues are found.
fn_print_warn_nl "Permissions issue found"
fn_script_log_warn "Permissions issue found"
fn_print_information_nl "The following file is not executable:"
@ -114,17 +114,17 @@ fn_check_permissions(){
fn_script_log_info "${executabledir}/${execname}"
fn_print_information_nl "Applying chmod u+x,g+x ${executabledir}/${execname}"
fn_script_log_info "Applying chmod u+x,g+x ${execperm}"
# Make the executable executable
# Make the executable executable.
chmod u+x,g+x "${executabledir}/${execname}"
# Second check to see if it's been successfully applied
# Get permission numbers on file under the form 775
# Second check to see if it's been successfully applied.
# Get permission numbers on file under the form 775.
execperm="$(stat -c %a "${executabledir}/${execname}")"
# Grab the first and second digit for user and group permission
# Grab the first and second digit for user and group permission.
userexecperm="${execperm:0:1}"
groupexecperm="${execperm:1:1}"
if [ "${userexecperm}" == "0" ]||[ "${userexecperm}" == "2" ]||[ "${userexecperm}" == "4" ]||[ "${userexecperm}" == "6" ]; then
if [ "${groupexecperm}" == "0" ]||[ "${groupexecperm}" == "2" ]||[ "${groupexecperm}" == "4" ]||[ "${groupexecperm}" == "6" ]; then
# If errors are still found
# If errors are still found.
fn_print_fail_nl "The following file could not be set executable:"
ls -l "${executabledir}/${execname}"
fn_script_log_warn "The following file could not be set executable:"
@ -141,16 +141,16 @@ fn_check_permissions(){
fi
}
## The following fn_sys_perm_* functions checks for permission errors in /sys directory
## The following fn_sys_perm_* functions checks for permission errors in /sys directory.
# Checks for permission errors in /sys directory
# Checks for permission errors in /sys directory.
fn_sys_perm_errors_detect(){
# Reset test variables
# Reset test variables.
sysdirpermerror="0"
classdirpermerror="0"
netdirpermerror="0"
# Check permissions
# /sys, /sys/class and /sys/class/net should be readable & executable
# Check permissions/
# /sys, /sys/class and /sys/class/net should be readable & executable.
if [ ! -r "/sys" ]||[ ! -x "/sys" ]; then
sysdirpermerror="1"
fi
@ -162,7 +162,7 @@ fn_sys_perm_errors_detect(){
fi
}
# Display a message on how to fix the issue manually
# Display a message on how to fix the issue manually.
fn_sys_perm_fix_manually_msg(){
echo ""
fn_print_information_nl "This error causes servers to fail starting properly"
@ -179,7 +179,7 @@ fn_sys_perm_fix_manually_msg(){
core_exit.sh
}
# Attempt to fix /sys related permission errors if sudo is available, exits otherwise
# Attempt to fix /sys related permission errors if sudo is available, exits otherwise.
fn_sys_perm_errors_fix(){
sudo -n true > /dev/null 2>&1
if [ $? -eq 0 ]; then
@ -194,28 +194,28 @@ fn_sys_perm_errors_fix(){
if [ "${netdirpermerror}" == "1" ]; then
sudo chmod a+rx "/sys/class/net"
fi
# Run check again to see if it's fixed
# Run check again to see if it's fixed.
fn_sys_perm_errors_detect
if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then
fn_print_error "Could not fix /sys permissions"
fn_script_log_error "Could not fix /sys permissions."
fn_sleep_time
# Show the user how to fix
# Show the user how to fix.
fn_sys_perm_fix_manually_msg
else
fn_print_ok_nl "Automatically fixing /sys permissions"
fn_script_log_pass "Permissions in /sys fixed"
fi
else
# Show the user how to fix
# Show the user how to fix.
fn_sys_perm_fix_manually_msg
fi
}
# Processes to the /sys related permission errors check & fix/info
# Processes to the /sys related permission errors check & fix/info.
fn_sys_perm_error_process(){
fn_sys_perm_errors_detect
# If any error was found
# If any error was found.
if [ "${sysdirpermerror}" == "1" ]||[ "${classdirpermerror}" == "1" ]||[ "${netdirpermerror}" == "1" ]; then
fn_print_error_nl "Permission error(s) found in /sys"
fn_script_log_error "Permission error(s) found in /sys"
@ -224,9 +224,9 @@ fn_sys_perm_error_process(){
fi
}
# Run perm error detect & fix/alert functions on /sys directories
# Run perm error detect & fix/alert functions on /sys directories.
## Run checks
## Run checks.
if [ "$(whoami)" != "root" ]; then
fn_check_ownership
fn_check_permissions

View File

@ -33,7 +33,7 @@ fn_check_steamcmd_user(){
fi
core_exit.sh
fi
# Anonymous user is set if steamuser is missing
# Anonymous user is set if steamuser is missing.
if [ -z "${steamuser}" ]; then
if [ -d "${lgsmlogdir}" ]; then
fn_script_log_info "Using anonymous Steam login"

View File

@ -42,7 +42,7 @@ fi
if [ -n "${ramrequirementmb}" ]; then
if [ "${physmemtotalmb}" -lt "${ramrequirementmb}" ]; then
fn_print_dots "Check RAM"
# Warn the user
# Warn the user.
fn_print_warn_nl "Check RAM: ${ramrequirementgb}G required, ${physmemtotal} available"
echo " * ${gamename} server may fail to run or experience poor performance."
fn_sleep_time

View File

@ -21,12 +21,12 @@ fn_backup_trap(){
echo -en "backup ${backupname}.tar.gz..."
fn_print_removed_eol_nl
fn_script_log_info "Backup ${backupname}.tar.gz: REMOVED"
# Remove lock file
# Remove lock file.
rm -f "${tmpdir}/.backup.lock"
core_exit.sh
}
# Check if a backup is pending or has been aborted using .backup.lock
# Check if a backup is pending or has been aborted using .backup.lock.
fn_backup_check_lockfile(){
if [ -f "${tmpdir}/.backup.lock" ]; then
fn_print_info_nl "Lock file found: Backup is currently running"
@ -35,9 +35,9 @@ fn_backup_check_lockfile(){
fi
}
# Initialisation
# Initialisation.
fn_backup_init(){
# Backup file name with servicename and current date
# Backup file name with servicename and current date.
backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')"
info_distro.sh
@ -58,20 +58,20 @@ fn_backup_init(){
fi
}
# Check if server is started and whether to stop it
# Check if server is started and whether to stop it.
fn_backup_stop_server(){
check_status.sh
# Server is stopped
# Server is stopped.
if [ "${status}" == "0" ]; then
serverstopped="no"
# Server is running and stoponbackup=off
# Server is running and stoponbackup=off.
elif [ "${stoponbackup}" == "off" ]; then
serverstopped="no"
fn_print_warn_nl "${servicename} is currently running"
echo " * Although unlikely; creating a backup while ${servicename} is running might corrupt the backup."
fn_script_log_warn "${servicename} is currently running"
fn_script_log_warn "Although unlikely; creating a backup while ${servicename} is running might corrupt the backup"
# Server is running and will be stopped if stoponbackup=on or unset
# Server is running and will be stopped if stoponbackup=on or unset.
else
fn_print_warn_nl "${servicename} will be stopped during the backup"
fn_script_log_warn "${servicename} will be stopped during the backup"
@ -81,16 +81,16 @@ fn_backup_stop_server(){
fi
}
# Create required folders
# Create required folders.
fn_backup_dir(){
# Create backupdir if it doesn't exist
# Create backupdir if it doesn't exist.
if [ ! -d "${backupdir}" ]; then
mkdir -p "${backupdir}"
fi
}
fn_backup_create_lockfile(){
# Create lockfile
# Create lockfile.
date > "${tmpdir}/.backup.lock"
fn_script_log_info "Lockfile generated"
fn_script_log_info "${tmpdir}/.backup.lock"
@ -98,9 +98,9 @@ fn_backup_create_lockfile(){
trap fn_backup_trap INT
}
# Compressing files
# Compressing files.
fn_backup_compression(){
# Tells how much will be compressed using rootdirduexbackup value from info_distro and prompt for continue
# Tells how much will be compressed using rootdirduexbackup value from info_distro and prompt for continue.
fn_print_info "A total of ${rootdirduexbackup} will be compressed."
fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.tar.gz"
fn_print_dots "Backup (${rootdirduexbackup}) ${backupname}.tar.gz, in progress..."
@ -131,36 +131,36 @@ fn_backup_compression(){
rm -f "${tmpdir}/.backup.lock"
}
# Clear old backups according to maxbackups and maxbackupdays variables
# Clear old backups according to maxbackups and maxbackupdays variables.
fn_backup_prune(){
# Clear if backup variables are set
# Clear if backup variables are set.
if [ -n "${maxbackups}" ]&&[ -n "${maxbackupdays}" ]; then
# How many backups there are
# How many backups there are.
info_distro.sh
# How many backups exceed maxbackups
# How many backups exceed maxbackups.
backupquotadiff=$((backupcount-maxbackups))
# How many backups exceed maxbackupdays
# How many backups exceed maxbackupdays.
backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}"|wc -l)
# If anything can be cleared
# If anything can be cleared.
if [ "${backupquotadiff}" -gt "0" ]||[ "${backupsoudatedcount}" -gt "0" ]; then
fn_print_dots "Pruning"
fn_script_log_info "Backup pruning activated"
fn_print_ok_nl "Pruning"
# If maxbackups greater or equal to backupsoutdatedcount, then it is over maxbackupdays
# If maxbackups greater or equal to backupsoutdatedcount, then it is over maxbackupdays.
if [ "${backupquotadiff}" -ge "${backupsoudatedcount}" ]; then
# Display how many backups will be cleared
# Display how many backups will be cleared.
echo " * Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit"
fn_script_log_info "Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit"
fn_sleep_time
fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)"
# Clear backups over quota
# Clear backups over quota.
find "${backupdir}"/ -type f -name "*.tar.gz" -printf '%T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
fn_print_ok_nl "Pruning: Clearing ${backupquotadiff} backup(s)"
fn_script_log_pass "Pruning: Cleared ${backupquotadiff} backup(s)"
# If maxbackupdays is used over maxbackups
# If maxbackupdays is used over maxbackups.
elif [ "${backupquotadiff}" -lt "${backupsoudatedcount}" ]; then
# Display how many backups will be cleared
# Display how many backups will be cleared.
echo " * Pruning: ${backupsoudatedcount} backup(s) are older than ${maxbackupdays} days."
fn_script_log_info "Pruning: ${backupsoudatedcount} backup(s) older than ${maxbackupdays} days."
fn_sleep_time
@ -176,9 +176,9 @@ fn_backup_prune(){
}
fn_backup_relpath() {
# Written by CedarLUG as a "realpath --relative-to" alternative in bash
# Written by CedarLUG as a "realpath --relative-to" alternative in bash.
# Populate an array of tokens initialized from the rootdir components:
# Populate an array of tokens initialized from the rootdir components.
declare -a rdirtoks=($(readlink -f "${rootdir}" | sed "s/\// /g"))
if [ ${#rdirtoks[@]} -eq 0 ]; then
@ -187,7 +187,7 @@ fn_backup_relpath() {
core_exit.sh
fi
# Populate an array of tokens initialized from the backupdir components:
# Populate an array of tokens initialized from the backupdir components.
declare -a bdirtoks=($(readlink -f "${backupdir}" | sed "s/\// /g"))
if [ ${#bdirtoks[@]} -eq 0 ]; then
fn_print_fail_nl "Problem assessing backupdir during relative path assessment"
@ -195,14 +195,14 @@ fn_backup_relpath() {
core_exit.sh
fi
# Compare the leading entries of each array. These common elements will be clipped off
# Compare the leading entries of each array. These common elements will be clipped off.
# for the relative path output.
for ((base=0; base<${#rdirtoks[@]}; base++))
do
[[ "${rdirtoks[$base]}" != "${bdirtoks[$base]}" ]] && break
done
# Next, climb out of the remaining rootdir location with updir references...
# Next, climb out of the remaining rootdir location with updir references.
for ((x=base;x<${#rdirtoks[@]};x++))
do
echo -n "../"
@ -215,7 +215,7 @@ fn_backup_relpath() {
done
# In the event there were no directories left in the backupdir above to
# traverse down, just add a newline. Otherwise at this point, there is
# traverse down, just add a newline. Otherwise at this point, there is
# one remaining directory component in the backupdir to navigate.
if (( "$base" < "${#bdirtoks[@]}" )) ; then
echo "${bdirtoks[ $(( ${#bdirtoks[@]} - 1)) ]}"
@ -224,7 +224,7 @@ fn_backup_relpath() {
fi
}
# Restart the server if it was stopped for the backup
# Restart the server if it was stopped for the backup.
fn_backup_start_server(){
if [ "${serverstopped}" == "yes" ]; then
exitbypass=1
@ -232,7 +232,7 @@ fn_backup_start_server(){
fi
}
# Run functions
# Run functions.
fn_backup_check_lockfile
fn_backup_create_lockfile
fn_backup_init

View File

@ -10,7 +10,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Trap to remove lockfile on quit.
fn_lockfile_trap(){
# Remove lockfile
# Remove lockfile.
rm -f "${rootdir}/${lockselfname}"
# resets terminal. Servers can sometimes mess up the terminal on exit.
reset
@ -23,7 +23,7 @@ check.sh
fix.sh
info_distro.sh
info_config.sh
# NOTE: Check if works with server without parms. Could be intergrated in to info_parms.sh
# NOTE: Check if works with server without parms. Could be intergrated in to info_parms.sh.
fn_parms
fn_print_header
echo -e "${blue}Distro:\t${default}${distroname}"
@ -35,7 +35,7 @@ echo -e "${blue}Avg Load:\t${default}${load}"
echo -e "${blue}Free Memory:\t${default}${physmemfree}"
echo -e "${blue}Free Disk:\t${default}${availspace}"
# glibc required
# glibc required.
if [ -n "${glibc}" ]; then
if [ "${glibc}" == "null" ]; then
# Glibc is not required.
@ -49,19 +49,19 @@ if [ -n "${glibc}" ]; then
fi
fi
# Server ip
# Server IP
if [ "${multiple_ip}" == "1" ]; then
echo -e "${blue}Server IP:\t${default}NOT SET"
else
echo -e "${blue}Server IP:\t${default}${ip}:${port}"
fi
# External server ip
# External server IP.
if [ -n "${extip}" ]; then
if [ "${ip}" != "${extip}" ]; then
echo -e "${blue}Internet IP:\t${default}${extip}:${port}"
fi
fi
# Listed on Master Server
# Listed on Master Server.
if [ "${masterserver}" ];then
if [ "${masterserver}" == "true" ];then
echo -e "${blue}Master Server:\t${green}${masterserver}${default}"
@ -69,7 +69,7 @@ if [ "${masterserver}" ];then
echo -e "${blue}Master Server:\t${red}${masterserver}${default}"
fi
fi
# Server password
# Server password.
if [ -n "${serverpassword}" ]; then
echo -e "${blue}Server password:\t${default}${serverpassword}"
fi
@ -97,7 +97,7 @@ fn_print_dots "Starting debug"
fn_script_log_info "Starting debug"
fn_print_ok_nl "Starting debug"
# Create lockfile
# Create lockfile.
date > "${rootdir}/${lockselfname}"
fn_script_log_info "Lockfile generated"
fn_script_log_info "${rootdir}/${lockselfname}"
@ -105,7 +105,7 @@ fn_script_log_info "${rootdir}/${lockselfname}"
trap fn_lockfile_trap INT
cd "${executabledir}" || exit
# Note: do not add double quotes to ${executable} ${parms}
# Note: do not add double quotes to ${executable} ${parms}.
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
${executable} ${parms} -debug
elif [ "${engine}" == "realvirtuality" ]; then

View File

@ -61,7 +61,7 @@ while read -r lib; do
local libs_array=( libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so)
for lib_file in "${libs_array[@]}"
do
# Known shared libs what dont requires dependencies
# Known shared libs what dont requires dependencies.
if [ "${lib}" == "${lib_file}" ]; then
libdetected=1
fi
@ -190,4 +190,4 @@ rm -f "${tmpdir}/.depdetect_readelf_uniq"
rm -f "${tmpdir}/.depdetect_unknown"
rm -f "${tmpdir}/.depdetect_unknown_uniq"
core_exit.sh
core_exit.sh

View File

@ -11,18 +11,18 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
check.sh
# Directories
# Directories.
if [ -z "${webdir}" ]; then
webdir="${rootdir}/public_html"
fi
fastdldir="${webdir}/fastdl"
addonsdir="${systemdir}/addons"
# Server lua autorun dir, used to autorun lua on client connect to the server
# Server lua autorun dir, used to autorun lua on client connect to the server.
luasvautorundir="${systemdir}/lua/autorun/server"
luafastdlfile="lgsm_cl_force_fastdl.lua"
luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
# Check if bzip2 is installed
# Check if bzip2 is installed.
if [ -z "$(command -v bzip2 2>/dev/null)" ]; then
fn_print_fail "bzip2 is not installed"
fn_script_log_fatal "bzip2 is not installed"
@ -34,11 +34,11 @@ fn_print_header
echo "More info: https://docs.linuxgsm.com/commands/fastdl"
echo ""
# Prompts user for FastDL creation settings
# Prompts user for FastDL creation settings.
echo "${commandaction} setup"
echo "================================="
# Prompt for clearing old files if directory was already here
# Prompt for clearing old files if directory was already here.
if [ -d "${fastdldir}" ]; then
fn_print_warning_nl "FastDL directory already exists."
echo "${fastdldir}"
@ -50,9 +50,9 @@ if [ -d "${fastdldir}" ]; then
fi
fi
# Garry's Mod Specific
# Garry's Mod Specific.
if [ "${shortname}" == "gmod" ]; then
# Prompt for download enforcer, which is using a .lua addfile resource generator
# Prompt for download enforcer, which is using a .lua addfile resource generator.
if fn_prompt_yn "Force clients to download files?" Y; then
luaresource="on"
fn_script_log_info "Force clients to download files: YES"
@ -62,9 +62,9 @@ if [ "${shortname}" == "gmod" ]; then
fi
fi
# Clears any fastdl directory content
# Clears any fastdl directory content.
fn_clear_old_fastdl(){
# Clearing old FastDL
# Clearing old FastDL.
if [ -d "${fastdldir}" ]; then
echo -en "clearing existing FastDL directory ${fastdldir}..."
rm -R "${fastdldir:?}"
@ -82,7 +82,7 @@ fn_clear_old_fastdl(){
}
fn_fastdl_dirs(){
# Check and create directories
# Check and create directories.
if [ ! -d "${webdir}" ]; then
echo -en "creating web directory ${webdir}..."
mkdir -p "${webdir}"
@ -143,9 +143,9 @@ fn_human_readable_file_size(){
fi
}
# Provides info about the fastdl directory content and prompts for confirmation
# Provides info about the fastdl directory content and prompts for confirmation.
fn_fastdl_preview(){
# Remove any file list
# Remove any file list.
if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
rm -f "${tmpdir}/fastdl_files_to_compress.txt"
fi
@ -206,7 +206,7 @@ fn_fastdl_preview(){
echo "calculating total file size..."
fn_sleep_time
totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt")
# Calculates total file size
# Calculates total file size.
while read -r dufile; do
filesize=$(stat -c %s "${dufile}")
filesizetotal=$(( ${filesizetotal} + ${filesize} ))
@ -231,7 +231,7 @@ fn_fastdl_preview(){
fi
}
# Builds Garry's Mod fastdl directory content
# Builds Garry's Mod fastdl directory content.
fn_fastdl_gmod(){
cd "${systemdir}" || exit
for allowed_extention in "${allowed_extentions_array[@]}"
@ -256,7 +256,7 @@ fn_fastdl_gmod(){
fn_print_ok_eol_nl
fi
done
# Correct addons directory structure for FastDL
# Correct addons directory structure for FastDL.
if [ -d "${fastdldir}/addons" ]; then
echo -en "updating addons file structure..."
cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}"
@ -269,7 +269,7 @@ fn_fastdl_gmod(){
fn_print_ok_eol_nl
fn_script_log_pass "Updating addons file structure"
fi
# Clear addons directory in fastdl
# Clear addons directory in fastdl.
echo -en "clearing addons dir from fastdl dir..."
fn_sleep_time
rm -R "${fastdldir:?}/addons"
@ -283,7 +283,7 @@ fn_fastdl_gmod(){
fn_script_log_pass "Clearing addons dir from fastdl dir"
fi
fi
# Correct content that may be into a lua directory by mistake like some darkrpmodification addons
# Correct content that may be into a lua directory by mistake like some darkrpmodification addons.
if [ -d "${fastdldir}/lua" ]; then
echo -en "correcting DarkRP files..."
fn_sleep_time
@ -300,7 +300,7 @@ fn_fastdl_gmod(){
fi
if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt")
# Calculates total file size
# Calculates total file size.
while read dufile; do
filesize=$(du -b "${dufile}" | awk '{ print $1 }')
filesizetotal=$(( ${filesizetotal} + ${filesize} ))
@ -353,9 +353,9 @@ fn_fastdl_source(){
done
}
# Builds the fastdl directory content
# Builds the fastdl directory content.
fn_fastdl_build(){
# Copy all needed files for FastDL
# Copy all needed files for FastDL.
echo -e "copying files to ${fastdldir}"
fn_script_log_info "Copying files to ${fastdldir}"
if [ "${shortname}" == "gmod" ]; then
@ -366,9 +366,9 @@ fn_fastdl_build(){
fi
}
# Generate lua file that will force download any file into the FastDL directory
# Generate lua file that will force download any file into the FastDL directory.
fn_fastdl_gmod_dl_enforcer(){
# Clear old lua file
# Clear old lua file.
if [ -f "${luafastdlfullpath}" ]; then
echo -en "removing existing download enforcer: ${luafastdlfile}..."
rm "${luafastdlfullpath:?}"
@ -382,11 +382,11 @@ fn_fastdl_gmod_dl_enforcer(){
fn_script_log_pass "Removing existing download enforcer ${luafastdlfullpath}"
fi
fi
# Generate new one if user said yes
# Generate new one if user said yes.
if [ "${luaresource}" == "on" ]; then
echo -en "creating new download enforcer: ${luafastdlfile}..."
touch "${luafastdlfullpath}"
# Read all filenames and put them into a lua file at the right path
# Read all filenames and put them into a lua file at the right path.
while read -r line; do
echo "resource.AddFile( \"${line}\" )" >> "${luafastdlfullpath}"
done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \) -printf '%P\n')
@ -402,7 +402,7 @@ fn_fastdl_gmod_dl_enforcer(){
fi
}
# Compresses FastDL files using bzip2
# Compresses FastDL files using bzip2.
fn_fastdl_bzip2(){
while read -r filetocompress; do
echo -en "\r\033[Kcompressing ${filetocompress}..."
@ -419,13 +419,13 @@ fn_fastdl_bzip2(){
fn_print_ok_eol_nl
}
# Run functions
# Run functions.
fn_fastdl_preview
fn_clear_old_fastdl
fn_fastdl_dirs
fn_fastdl_build
fn_fastdl_bzip2
# Finished message
# Finished message.
echo "FastDL files are located in:"
echo "${fastdldir}"
echo "FastDL completed"

View File

@ -18,7 +18,7 @@ else
install_logs.sh
check_deps.sh
installflag=1
# Download and install
# Download and install.
if [ "${shortname}" == "ut2k4" ]; then
install_server_files.sh
install_ut2k4_key.sh
@ -30,7 +30,7 @@ else
install_server_files.sh
fi
# Configuration
# Configuration.
install_config.sh
if [ -v "${gslt}" ]; then
install_gslt.sh

View File

@ -14,17 +14,17 @@ mods_core.sh
fn_print_header
# Displays a list of installed mods
# Displays a list of installed mods.
fn_mods_installed_list
if [ "${installedmodscount}" -gt "0" ]; then
echo "Installed addons/mods"
echo "================================="
# Go through all available commands, get details and display them to the user
# Go through all available commands, get details and display them to the user.
for ((llindex=0; llindex < ${#installedmodslist[@]}; llindex++)); do
# Current mod is the "llindex" value of the array we're going through
# Current mod is the "llindex" value of the array we're going through.
currentmod="${installedmodslist[llindex]}"
fn_mod_get_info
# Display mod info to the user
# Display mod info to the user.
echo -e " * ${green}${modcommand}${default}${default}"
done
echo ""
@ -32,25 +32,25 @@ fi
echo "Available addons/mods"
echo "================================="
# Display available mods from mods_list.sh
# Display available mods from mods_list.sh.
# Set and reset vars
compatiblemodslistindex=0
# As long as we're within index values
# As long as we're within index values.
while [ "${compatiblemodslistindex}" -lt "${#compatiblemodslist[@]}" ]; do
# Set values for convenience
# Set values for convenience.
displayedmodname="${compatiblemodslist[compatiblemodslistindex]}"
displayedmodcommand="${compatiblemodslist[compatiblemodslistindex+1]}"
displayedmodsite="${compatiblemodslist[compatiblemodslistindex+2]}"
displayedmoddescription="${compatiblemodslist[compatiblemodslistindex+3]}"
# Output mods to the user
# Output mods to the user.
echo -e "${displayedmodname} - ${displayedmoddescription} - ${displayedmodsite}"
echo -e " * ${cyan}${displayedmodcommand}${default}"
# Increment index from the amount of values we just displayed
# Increment index from the amount of values we just displayed.
let "compatiblemodslistindex+=4"
((totalmodsavailable++))
done
# If no mods are available for a specific game
# If no mods are available for a specific game.
if [ -z "${compatiblemodslist}" ]; then
fn_print_fail_nl "No mods are currently available for ${gamename}."
fn_script_log_info "No mods are currently available for ${gamename}."
@ -58,20 +58,20 @@ if [ -z "${compatiblemodslist}" ]; then
fi
fn_script_log_info "${totalmodsavailable} addons/mods are available for install"
## User selects a mod
## User selects a mod.
echo ""
while [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; do
echo -en "Enter an ${cyan}addon/mod${default} to ${green}install${default} (or exit to abort): "
read -r usermodselect
# Exit if user says exit or abort
# Exit if user says exit or abort.
if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
core_exit.sh
# Supplementary output upon invalid user input
# Supplementary output upon invalid user input.
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
fi
done
# Get mod info
# Get mod info.
currentmod="${usermodselect}"
fn_mod_get_info
@ -80,7 +80,7 @@ echo "Installing ${modprettyname}"
echo "================================="
fn_script_log_info "${modprettyname} selected for install"
# Check if the mod is already installed and warn the user
# Check if the mod is already installed and warn the user.
if [ -f "${modsinstalledlistfullpath}" ]; then
if [ -n "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
fn_print_warning_nl "${modprettyname} is already installed"
@ -93,7 +93,7 @@ if [ -f "${modsinstalledlistfullpath}" ]; then
fi
fi
## Installation
## Installation.
fn_create_mods_dir
fn_mods_clear_tmp_dir

View File

@ -17,27 +17,27 @@ fn_print_header
echo "Remove addons/mods"
echo "================================="
## Displays list of installed mods
# Generates list to display to user
# Displays list of installed mods.
# Generates list to display to user.
fn_mods_installed_list
for ((mlindex=0; mlindex < ${#installedmodslist[@]}; mlindex++)); do
# Current mod is the "mlindex" value of the array we are going through
# Current mod is the "mlindex" value of the array we are going through.
currentmod="${installedmodslist[mlindex]}"
# Get mod info
# Get mod info.
fn_mod_get_info
# Display mod info to the user
# Display mod info to the user.
echo -e "${red}${modcommand}${default} - ${modprettyname} - ${moddescription}"
done
echo ""
# Keep prompting as long as the user input doesn't correspond to an available mod
# Keep prompting as long as the user input doesn't correspond to an available mod.
while [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; do
echo -en "Enter an ${cyan}addon/mod${default} to ${red}remove${default} (or exit to abort): "
read -r usermodselect
# Exit if user says exit or abort
# Exit if user says exit or abort.
if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
core_exit.sh
# Supplementary output upon invalid user input
# Supplementary output upon invalid user input.
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
fi
@ -53,19 +53,19 @@ currentmod="${usermodselect}"
fn_mod_get_info
fn_check_mod_files_list
# Uninstall the mod
# Uninstall the mod.
fn_script_log_info "Removing ${modsfilelistsize} files from ${modprettyname}"
echo -e "removing ${modprettyname}"
echo -e "* ${modsfilelistsize} files to be removed"
echo -e "* location: ${modinstalldir}"
fn_sleep_time
# Go through every file and remove it
# Go through every file and remove it.
modfileline="1"
tput sc
while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
# Current line defines current file to remove
# Current line defines current file to remove.
currentfileremove="$(sed "${modfileline}q;d" "${modsdir}/${modcommand}-files.txt")"
# If file or directory exists, then remove it
# If file or directory exists, then remove it.
if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then
rm -rf "${modinstalldir:?}/${currentfileremove}"
@ -88,7 +88,7 @@ else
fn_print_ok_eol_nl
fi
fn_sleep_time
# Remove file list
# Remove file list.
echo -en "removing ${modcommand}-files.txt..."
fn_sleep_time
rm -rf "${modsdir}/${modcommand}-files.txt"
@ -102,7 +102,7 @@ else
fn_print_ok_eol_nl
fi
# Remove mods from installed mods list
# Remove mods from installed mods list.
echo -en "removing ${modcommand} from ${modsinstalledlist}..."
fn_sleep_time
@ -118,7 +118,7 @@ else
fi
# Oxide fix
# Oxide replaces server files, so a validate is required after uninstall
# Oxide replaces server files, so a validate is required after uninstall.
if [ "${engine}" == "unity3d" ]&&[[ "${modprettyname}" == *"Oxide"* ]]; then
fn_print_information_nl "Validating to restore original ${gamename} files replaced by Oxide"
fn_script_log "Validating to restore original ${gamename} files replaced by Oxide"

View File

@ -12,23 +12,23 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
check.sh
mods_core.sh
# Prevents specific files being overwritten upon update (set by ${modkeepfiles})
# For that matter, remove cfg files after extraction before copying them to destination
# Prevents specific files being overwritten upon update (set by ${modkeepfiles}).
# For that matter, remove cfg files after extraction before copying them to destination.
fn_remove_cfg_files(){
if [ "${modkeepfiles}" != "OVERWRITE" ]&&[ "${modkeepfiles}" != "NOUPDATE" ]; then
echo -e "the following files/directories will be preserved:"
fn_sleep_time
# Count how many files there are to remove
# Count how many files there are to remove.
filestopreserve="$(echo "${modkeepfiles}" | awk -F ';' '{ print NF }')"
# Test all subvalues of "modkeepfiles" using the ";" separator
# Test all subvalues of "modkeepfiles" using the ";" separator.
for ((preservefilesindex=1; preservefilesindex < ${filestopreserve}; preservefilesindex++)); do
# Put the current file we are looking for into a variable
# Put the current file we are looking for into a variable.
filetopreserve="$(echo "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }' )"
echo -e " * serverfiles/${filetopreserve}"
# If it matches an existing file that have been extracted delete the file
# If it matches an existing file that have been extracted delete the file.
if [ -f "${extractdir}/${filetopreserve}" ]||[ -d "${extractdir}/${filetopreserve}" ]; then
rm -r "${extractdir:?}/${filetopreserve}"
# Write the file path in a tmp file, to rebuild a full file list as it is rebuilt upon update
# Write the file path in a tmp file, to rebuild a full file list as it is rebuilt upon update.
if [ ! -f "${modsdir}/.removedfiles.tmp" ]; then
touch "${modsdir}/.removedfiles.tmp"
fi
@ -43,22 +43,22 @@ fn_mods_check_installed
fn_print_info_nl "Update addons/mods: ${installedmodscount} addons/mods will be updated"
fn_script_log_info "${installedmodscount} mods or addons will be updated"
fn_mods_installed_list
# Go through all available commands, get details and display them to the user
# Go through all available commands, get details and display them to the user.
for ((ulindex=0; ulindex < ${#installedmodslist[@]}; ulindex++)); do
# Current mod is the "ulindex" value of the array we're going through
# Current mod is the "ulindex" value of the array we're going through.
currentmod="${installedmodslist[ulindex]}"
fn_mod_get_info
# Display installed mods and the update policy
# Display installed mods and the update policy.
if [ -z "${modkeepfiles}" ]; then
# If modkeepfiles is not set for some reason, that's a problem
# If modkeepfiles is not set for some reason, that's a problem.
fn_script_log_error "Could not find update policy for ${modprettyname}"
fn_print_error_nl "Could not find update policy for ${modprettyname}"
exitcode="1"
core_exit.sh
# If the mod won't get updated
# If the mod won't get updated.
elif [ "${modkeepfiles}" == "NOUPDATE" ]; then
echo -e " * ${red}{modprettyname}${default} (won't be updated)"
# If the mode is just overwritten
# If the mode is just overwritten.
elif [ "${modkeepfiles}" == "OVERWRITE" ]; then
echo -e " * ${modprettyname} (overwrite)"
else
@ -67,14 +67,14 @@ for ((ulindex=0; ulindex < ${#installedmodslist[@]}; ulindex++)); do
done
## Update
# List all installed mods and apply update
# Reset line value
# List all installed mods and apply update.
# Reset line value.
installedmodsline="1"
while [ "${installedmodsline}" -le "${installedmodscount}" ]; do
currentmod="$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")"
if [ -n "${currentmod}" ]; then
fn_mod_get_info
# Don not update mod if the policy is set to "NOUPDATE"
# Don not update mod if the policy is set to "NOUPDATE".
if [ "${modkeepfiles}" == "NOUPDATE" ]; then
fn_print_info "${modprettyname} will not be updated to preserve custom files"
fn_script_log_info "${modprettyname} will not be updated to preserve custom files"

View File

@ -31,10 +31,10 @@ posttarget=${posttarget="https://hastebin.com"}
# For pastebin, you can set the expiration period.
# use 1 week as the default, other options are '24h' for a day, etc.
# This, too, may be overridden from the command line at the top-level
# This, too, may be overridden from the command line at the top-level.
postexpire="${postexpire="30D"}"
# source all of the functions defined in the details command
# source all of the functions defined in the details command.
info_messages.sh
fn_bad_postdetailslog() {
@ -42,12 +42,12 @@ fn_bad_postdetailslog() {
core_exit.sh
}
# Remove any existing postdetails.log file
# Remove any existing postdetails.log file.
if [ -f "${postdetailslog}" ]; then
rm -f "${postdetailslog}"
fi
# Rather than a one-pass sed parser, default to using a temporary directory
# Rather than a one-pass sed parser, default to using a temporary directory.
if [ -n "${alertflag}" ]; then
postdetailslog="${alertlog}"
else

View File

@ -28,9 +28,9 @@ fn_start_teamspeak3(){
if [ -f "${lgsmlog}" ]; then
mv "${lgsmlog}" "${lgsmlogdate}"
fi
# Create lockfile
# Create lockfile.
date > "${rootdir}/${lockselfname}"
# Accept license
# Accept license.
if [ ! -f "${executabledir}/.ts3server_license_accepted" ]; then
install_eula.sh
fi
@ -59,7 +59,7 @@ fn_start_tmux(){
else
fn_parms
fi
# check for tmux size variables
# check for tmux size variables.
if [[ "${servercfgtmuxwidth}" =~ ^[0-9]+$ ]]; then
sessionwidth="${servercfgtmuxwidth}"
else
@ -71,7 +71,7 @@ fn_start_tmux(){
sessionheight="23"
fi
# Log rotation
# Log rotation.
fn_script_log_info "Rotating log files"
if [ "${engine}" == "unreal2" ]&&[ -f "${gamelog}" ]; then
mv "${gamelog}" "${gamelogdate}"
@ -83,17 +83,17 @@ fn_start_tmux(){
mv "${consolelog}" "${consolelogdate}"
fi
# Create lockfile
# Create lockfile.
date > "${rootdir}/${lockselfname}"
cd "${executabledir}"
tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${servicename}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${servicename}-tmux-error.tmp"
# Create logfile
# Create logfile.
touch "${consolelog}"
# Get tmux version
# Get tmux version.
tmuxversion="$(tmux -V | sed "s/tmux //" | sed -n '1 p')"
# Tmux compiled from source will return "master", therefore ignore it
# Tmux compiled from source will return "master", therefore ignore it.
if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p')" == "master" ]; then
fn_script_log "Tmux version: master (user compiled)"
echo "Tmux version: master (user compiled)" >> "${consolelog}"
@ -101,20 +101,20 @@ fn_start_tmux(){
tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
fi
elif [ -n "${tmuxversion}" ]; then
# Get the digit version of tmux
# Get the digit version of tmux.
tmuxversion="$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')"
# tmux pipe-pane not supported in tmux versions < 1.6
# tmux pipe-pane not supported in tmux versions < 1.6.
if [ "${tmuxversion}" -lt "16" ]; then
echo "Console logging disabled: Tmux => 1.6 required
https://linuxgsm.com/tmux-upgrade
Currently installed: $(tmux -V)" > "${consolelog}"
# Console logging disabled: Bug in tmux 1.8 breaks logging
# Console logging disabled: Bug in tmux 1.8 breaks logging.
elif [ "${tmuxversion}" -eq "18" ]; then
echo "Console logging disabled: Bug in tmux 1.8 breaks logging
https://linuxgsm.com/tmux-upgrade
Currently installed: $(tmux -V)" > "${consolelog}"
# Console logging enable or not set
# Console logging enable or not set.
elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
fi
@ -123,14 +123,14 @@ fn_start_tmux(){
fn_script_log_warn "Unable to detect tmux version"
fi
# Console logging disabled
# Console logging disabled.
if [ "${consolelogging}" == "off" ]; then
echo "Console logging disabled by user" >> "${consolelog}"
fn_script_log_info "Console logging disabled by user"
fi
fn_sleep_time
# If the server fails to start
# If the server fails to start.
check_status.sh
if [ "${status}" == "0" ]; then
fn_print_fail_nl "Unable to start ${servername}"
@ -187,8 +187,9 @@ fn_sleep_time
fn_print_dots "${servername}"
check.sh
# Is the server already started
if [ "${status}" != "0" ]; then # $status comes from check_status.sh, which is run by check.sh for this command
# Is the server already started.
# $status comes from check_status.sh, which is run by check.sh for this command
if [ "${status}" != "0" ]; then
fn_print_info_nl "${servername} is already running"
fn_script_log_error "${servername} is already running"
if [ -z "${exitbypass}" ]; then
@ -201,7 +202,7 @@ fi
info_config.sh
logs.sh
# Will check for updates is updateonstart is yes
# Will check for updates is updateonstart is yes.
if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
exitbypass=1
unset updateonstart

View File

@ -9,13 +9,13 @@ local commandname="STOP"
local commandaction="Stopping"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Attempts graceful shutdown by sending the 'CTRL+c'.
# Attempts graceful shutdown by sending 'CTRL+c'.
fn_stop_graceful_ctrlc(){
fn_print_dots "Graceful: CTRL+c"
fn_script_log_info "Graceful: CTRL+c"
# sends quit
# Sends quit.
tmux send-keys -t "${servicename}" C-c > /dev/null 2>&1
# waits up to 30 seconds giving the server time to shutdown gracefuly
# Waits up to 30 seconds giving the server time to shutdown gracefuly.
for seconds in {1..30}; do
check_status.sh
if [ "${status}" == "0" ]; then
@ -38,13 +38,13 @@ fn_stop_graceful_ctrlc(){
# Attempts graceful shutdown by sending a specified command.
# Usage: fn_stop_graceful_cmd "console_command" "timeout_in_seconds"
# e.g.: fn_stop_graceful_cmd "quit" "30"
# e.g.: fn_stop_graceful_cmd "quit" "30"
fn_stop_graceful_cmd(){
fn_print_dots "Graceful: sending \"${1}\""
fn_script_log_info "Graceful: sending \"${1}\""
# sends specific stop command
# Sends specific stop command.
tmux send -t "${servicename}" "${1}" ENTER > /dev/null 2>&1
# waits up to given seconds giving the server time to shutdown gracefully
# Waits up to ${seconds} seconds giving the server time to shutdown gracefully.
for ((seconds=1; seconds<=${2}; seconds++)); do
check_status.sh
if [ "${status}" == "0" ]; then
@ -65,16 +65,15 @@ fn_stop_graceful_cmd(){
fn_sleep_time
}
# Attempts graceful of goldsource using rcon 'quit' command.
# Goldsource 'quit' command restarts rather than shutdown
# this function will only wait 3 seconds then force a tmux shutdown.
# preventing the server from coming back online.
# Attempts graceful shutdown of goldsource using rcon 'quit' command.
# There is only a 3 second delay before a forced a tmux shutdown
# as Goldsource servers 'quit' command does a restart rather than shutdown.
fn_stop_graceful_goldsource(){
fn_print_dots "Graceful: sending \"quit\""
fn_script_log_info "Graceful: sending \"quit\""
# sends quit
tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
# waits 3 seconds as goldsource servers restart with the quit command
# Waits 3 seconds as goldsource servers restart with the quit command.
for seconds in {1..3}; do
sleep 1
fn_print_dots "Graceful: sending \"quit\": ${seconds}"
@ -84,7 +83,6 @@ fn_stop_graceful_goldsource(){
fn_script_log_pass "Graceful: sending \"quit\": OK: ${seconds} seconds"
}
# Attempts graceful of 7 Days To Die using telnet.
fn_stop_telnet_sdtd(){
if [ -z "${telnetpass}" ]||[ "${telnetpass}" == "NOT SET" ]; then
sdtd_telnet_shutdown=$( expect -c '
@ -121,6 +119,7 @@ fn_stop_telnet_sdtd(){
fi
}
# Attempts graceful shutdown of 7 Days To Die using telnet.
fn_stop_graceful_sdtd(){
fn_print_dots "Graceful: telnet"
fn_script_log_info "Graceful: telnet"
@ -143,8 +142,8 @@ fn_stop_graceful_sdtd(){
fi
done
# If telnet was successful will use telnet again to check the connection has closed
# This confirms that the tmux session can now be killed.
# If telnet shutdown was successful will use telnet again to check
# the connection has closed, confirming that the tmux session can now be killed.
if [ -n "${completed}" ]; then
for seconds in {1..30}; do
fn_stop_telnet_sdtd
@ -158,8 +157,7 @@ fn_stop_graceful_sdtd(){
sleep 1
fn_print_dots "Graceful: telnet: ${seconds}"
done
# If telnet failed will go straight to tmux shutdown.
# If cannot shutdown correctly world save may be lost
# If telnet shutdown fails tmux shutdown will be used, this risks loss of world save.
else
if [ -n "${refused}" ]; then
fn_print_error "Graceful: telnet: "
@ -185,26 +183,28 @@ fn_stop_graceful_sdtd(){
fn_stop_graceful_select(){
if [ "${shortname}" == "sdtd" ]; then
fn_stop_graceful_sdtd
elif [ "${engine}" == "Spark" ]; then
elif [ "${engine}" == "spark" ]; then
fn_stop_graceful_cmd "q" 30
elif [ "${shortname}" == "terraria" ]; then
fn_stop_graceful_cmd "exit" 30
elif [ "${shortname}" == "mc" ]; then
fn_stop_graceful_cmd "stop" 30
elif [ "${shortname}" == "mta" ]; then
# we need a long wait time here as resources are stopped individually and process their own shutdowns
# Long wait time required for mta
# as resources shutdown individually.
fn_stop_graceful_cmd "quit" 120
elif [ "${engine}" == "goldsource" ]; then
fn_stop_graceful_goldsource
elif [ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal4" ]||[ "${engine}" == "unreal3" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal" ]||[ "${shortname}" == "fctr" ]||[ "${shortname}" == "mumble" ]||[ "${shortname}" == "wurm" ]||[ "${shortname}" == "jc2" ]||[ "${shortname}" == "jc3" ]; then
fn_stop_graceful_ctrlc
elif [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${shortname}" == "jc2" ]||[ "${shortname}" == "pz" ]||[ "${shortname}" == "rw" ]; then
elif [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${shortname}" == "pz" ]||[ "${shortname}" == "rw" ]; then
fn_stop_graceful_cmd "quit" 30
fi
}
fn_stop_ark(){
maxpiditer=15 # The maximum number of times to check if the ark pid has closed gracefully.
# The maximum number of times to check if the ark pid has closed gracefully.
maxpiditer=15
info_config.sh
if [ -z "${queryport}" ]; then
fn_print_warn "No queryport found using info_config.sh"
@ -222,16 +222,15 @@ fn_stop_ark(){
if [ "${#queryport}" -gt 0 ] ; then
for (( pidcheck=0 ; pidcheck < ${maxpiditer} ; pidcheck++ )) ; do
pid=$(netstat -nap 2>/dev/null | grep "^udp[[:space:]]" | grep ":${queryport}[[:space:]]" | rev | awk '{print $1}' | rev | cut -d\/ -f1)
#
# check for a valid pid
# Check for a valid pid.
pid=${pid//[!0-9]/}
let pid+=0 # turns an empty string into a valid number, '0',
# and a valid numeric pid remains unchanged.
if [ "${pid}" -gt 1 ]&&[ "${pid}" -le "$(cat "/proc/sys/kernel/pid_max")" ]; then
fn_print_dots "Process still bound. Awaiting graceful exit: ${pidcheck}"
else
break # Our job is done here
fi # end if for pid range check
break
fi
done
if [[ ${pidcheck} -eq ${maxpiditer} ]] ; then
# The process doesn't want to close after 20 seconds.
@ -239,15 +238,14 @@ fn_stop_ark(){
fn_print_error "Terminating reluctant Ark process: ${pid}"
kill -9 ${pid}
fi
fi # end if for port check
} # end of fn_stop_ark
fi
}
fn_stop_teamspeak3(){
fn_print_dots "${servername}"
"${serverfiles}"/ts3server_startscript.sh stop > /dev/null 2>&1
check_status.sh
if [ "${status}" == "0" ]; then
# Remove lockfile
rm -f "${rootdir}/${lockselfname}"
fn_print_ok_nl "${servername}"
fn_script_log_pass "Stopped ${servername}"
@ -265,7 +263,7 @@ fn_stop_tmux(){
fn_sleep_time
check_status.sh
if [ "${status}" == "0" ]; then
# ARK doesn't clean up immediately after tmux is killed.
# ARK does not clean up immediately after tmux is killed.
# Make certain the ports are cleared before continuing.
if [ "${shortname}" == "ark" ]; then
fn_stop_ark
@ -278,10 +276,9 @@ fn_stop_tmux(){
fi
}
# checks if the server is already stopped before trying to stop.
# Checks if the server is already stopped.
fn_stop_pre_check(){
# Is the server already stopped
if [ "${status}" == "0" ]; then # $status comes from check_status.sh, which is run by check.sh for this command
if [ "${status}" == "0" ]; then
fn_print_info_nl "${servername} is already stopped"
fn_script_log_error "${servername} is already stopped"
elif [ "${shortname}" == "ts3" ]; then
@ -289,7 +286,7 @@ fn_stop_pre_check(){
else
fn_stop_graceful_select
fi
# Check status again, a stop tmux session if needed
# Check status again, a stop tmux session if needed.
check_status.sh
if [ "${status}" != "0" ]; then
fn_stop_tmux
@ -300,7 +297,7 @@ fn_print_dots "${servername}"
check.sh
info_config.sh
fn_stop_pre_check
# Remove lockfile
# Remove lockfile.
if [ -f "${rootdir}/${lockselfname}" ]; then
rm -f "${rootdir}/${lockselfname}"
fi

View File

@ -25,7 +25,7 @@ fn_serveradmin_password_prompt(){
fn_serveradmin_password_set(){
fn_print_info_nl "Starting server with new password..."
fn_script_log_info "Starting server with new password"
# Start server in "new password mode"
# Start server in "new password mode".
ts3serverpass="1"
exitbypass="1"
command_start.sh
@ -33,12 +33,12 @@ fn_serveradmin_password_set(){
fn_script_log_pass "New ServerAdmin password applied"
}
# Running functions
# Running functions.
check.sh
fn_serveradmin_password_prompt
check_status.sh
if [ "${status}" != "0" ]; then
# Stop any running server
# Stop any running server.
exitbypass="1"
command_stop.sh
fn_serveradmin_password_set

View File

@ -14,7 +14,7 @@ fn_script_log_info "Updating LinuxGSM"
echo -en "\n"
if [ -z "${legacymode}" ]; then
# Check and update _default.cfg
# Check and update _default.cfg.
echo -en " checking config _default.cfg...\c"
config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(${curlpath} -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
if [ "${config_file_diff}" != "" ]; then
@ -71,7 +71,7 @@ if [ -z "${legacymode}" ]; then
fi
fi
# Check and update functions
# Check and update functions.
if [ -n "${functionsdir}" ]; then
if [ -d "${functionsdir}" ]; then
cd "${functionsdir}" || exit

View File

@ -13,7 +13,7 @@ check.sh
fn_print_header
fn_script_log "Entering ${gamename} ${commandaction}"
# Process to server wipe
# Process to server wipe.
fn_wipe_server_process(){
check_status.sh
if [ "${status}" != "0" ]; then
@ -29,7 +29,7 @@ fn_wipe_server_process(){
fn_script_log "server data wiped."
}
# Provides an exit code upon error
# Provides an exit code upon error.
fn_wipe_exit_code(){
((exitcode=$?))
if [ ${exitcode} -ne 0 ]; then
@ -40,11 +40,11 @@ fn_wipe_exit_code(){
fi
}
# Removes files to wipe server
# Removes files to wipe server.
fn_wipe_server_remove_files(){
# Rust Wipe
# Rust Wipe.
if [ "${shortname}" == "rust" ]; then
# Wipe pocedural map
# Wipe pocedural map.
if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then
currentaction="Removing map file(s): ${serveridentitydir}/proceduralmap.*.map"
echo -en "Removing procedural map proceduralmap.*.map file(s)..."
@ -57,7 +57,7 @@ fn_wipe_server_remove_files(){
fn_print_information_nl "No procedural map file to remove"
fn_script_log_info "No procedural map file to remove."
fi
# Wipe procedural map save
# Wipe procedural map save.
if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
currentaction="Removing procedural map save(s): ${serveridentitydir}/proceduralmap.*.sav"
echo -en "Removing map saves proceduralmap.*.sav file(s)..."
@ -70,7 +70,7 @@ fn_wipe_server_remove_files(){
fn_print_information_nl "No procedural map save to remove"
fn_script_log_info "No procedural map save to remove."
fi
# Wipe Barren map
# Wipe Barren map.
if [ -n "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then
currentaction="Removing map file(s): ${serveridentitydir}/barren*.map"
echo -en "Removing barren map barren*.map file(s)..."
@ -83,7 +83,7 @@ fn_wipe_server_remove_files(){
fn_print_information_nl "No barren map file to remove"
fn_script_log_info "No barren map file to remove."
fi
# Wipe barren map save
# Wipe barren map save.
if [ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then
currentaction="Removing barren map save(s): ${serveridentitydir}/barren*.sav"
echo -en "Removing barren map saves barren*.sav file(s)..."
@ -96,7 +96,7 @@ fn_wipe_server_remove_files(){
fn_print_information_nl "No barren map save to remove"
fn_script_log_info "No barren map save to remove."
fi
# Wipe user dir, might be a legacy thing, maybe to be removed
# Wipe user dir, might be a legacy thing, maybe to be removed.
if [ -d "${serveridentitydir}/user" ]; then
currentaction="Removing user directory: ${serveridentitydir}/user"
echo -en "Removing user directory..."
@ -105,9 +105,9 @@ fn_wipe_server_remove_files(){
rm -rf "${serveridentitydir:?}/user"
fn_wipe_exit_code
fn_sleep_time
# We do not print additional information if there is nothing to remove since this might be obsolete
# We do not print additional information if there is nothing to remove since this might be obsolete.
fi
# Wipe storage dir, might be a legacy thing, maybe to be removed
# Wipe storage dir, might be a legacy thing, maybe to be removed.
if [ -d "${serveridentitydir}/storage" ]; then
currentaction="Removing storage directory: ${serveridentitydir}/storage"
echo -en "Removing storage directory..."
@ -116,9 +116,9 @@ fn_wipe_server_remove_files(){
rm -rf "${serveridentitydir:?}/storage"
fn_wipe_exit_code
fn_sleep_time
# We do not print additional information if there is nothing to remove since this might be obsolete
# We do not print additional information if there is nothing to remove since this might be obsolete.
fi
# Wipe sv.files
# Wipe sv.files.
if [ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
currentaction="Removing server misc files: ${serveridentitydir}/sv.files.*.db"
echo -en "Removing server misc srv.files*.db file(s)..."
@ -127,9 +127,9 @@ fn_wipe_server_remove_files(){
find "${serveridentitydir:?}" -type f -name "sv.files.*.d" -delete
fn_wipe_exit_code
fn_sleep_time
# No further information if not found because it should I could not get this file showing up
# No further information if not found because it should I could not get this file showing up.
fi
# Wipe player death files
# Wipe player death files.
if [ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]; then
currentaction="Removing player death files: ${serveridentitydir}/player.deaths.*.db"
echo -en "Removing player deaths player.deaths.*.db file(s)..."
@ -142,7 +142,7 @@ fn_wipe_server_remove_files(){
fn_print_information_nl "No player death to remove"
fn_script_log_info "No player death to remove."
fi
# Wipe blueprints only if wipeall command was used
# Wipe blueprints only if wipeall command was used.
if [ "${wipeall}" == "1" ]; then
if [ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
currentaction="Removing blueprint file(s): ${serveridentitydir}/player.blueprints.*.db"
@ -164,7 +164,7 @@ fn_wipe_server_remove_files(){
fn_script_log_info "No blueprints found."
fn_sleep_time
fi
# Wipe some logs that might be there
# Wipe some logs that might be there.
if [ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
currentaction="Removing log files: ${serveridentitydir}/Log.*.txt"
echo -en "Removing Log files..."
@ -173,14 +173,14 @@ fn_wipe_server_remove_files(){
find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete
fn_wipe_exit_code
fn_sleep_time
# We do not print additional information if there are no logs to remove
# We do not print additional information if there are no logs to remove.
fi
# You can add an "elif" here to add another game or engine
# You can add an "elif" here to add another game or engine.
fi
}
# Check if there is something to wipe, prompt the user, and call appropriate functions
# Rust Wipe
# Check if there is something to wipe, prompt the user, and call appropriate functions.
# Rust Wipe.
if [ "${shortname}" == "rust" ]; then
if [ -d "${serveridentitydir}/storage" ]||[ -d "${serveridentitydir}/user" ]||[ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
fn_print_warning_nl "Any user, storage, log and map data from ${serveridentitydir} will be erased."
@ -195,9 +195,9 @@ if [ "${shortname}" == "rust" ]; then
fn_script_log_info "No data to wipe was found."
core_exit.sh
fi
# You can add an "elif" here to add another game or engine
# You can add an "elif" here to add another game or engine.
else
# Game not listed
# Game not listed.
fn_print_information_nl "Wipe is not available for this game"
fn_script_log_info "Wipe is not available for this game."
core_exit.sh

View File

@ -6,9 +6,9 @@
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
### Define all commands here ###
### Define all commands here.
## User commands | Trigger commands | Description
# Standard commands
# Standard commands.
cmd_install=( "i;install" "command_install.sh" "Install the server." )
cmd_auto_install=( "ai;auto-install" "fn_autoinstall" "Install the server without prompts." )
cmd_start=( "st;start" "command_start.sh" "Start the server." )
@ -21,19 +21,19 @@ cmd_update_linuxgsm=( "ul;update-lgsm;uf;update-functions" "command_update_linux
cmd_test_alert=( "ta;test-alert" "command_test_alert.sh" "Send a test alert." )
cmd_monitor=( "m;monitor" "command_monitor.sh" "Check server status and restart if crashed." )
cmd_donate=( "do;donate" "command_donate.sh" "Donation options." )
# Console servers only
# Console servers only.
cmd_console=( "c;console" "command_console.sh" "Access server console." )
cmd_debug=( "d;debug" "command_debug.sh" "Start server directly in your terminal." )
# Update servers only
# Update servers only.
cmd_update=( "u;update" "command_update.sh" "Check and apply any server updates." )
cmd_force_update=( "fu;force-update;update-restart;ur" "forceupdate=1; command_update.sh" "Apply server updates bypassing check." )
# SteamCMD servers only
# SteamCMD servers only.
cmd_validate=( "v;validate" "command_validate.sh" "Validate server files with SteamCMD." )
# Server with mods-install
# Server with mods-install.
cmd_mods_install=( "mi;mods-install" "command_mods_install.sh" "View and install available mods/addons." )
cmd_mods_remove=( "mr;mods-remove" "command_mods_remove.sh" "View and remove an installed mod/addon." )
cmd_mods_update=( "mu;mods-update" "command_mods_update.sh" "Update installed mods/addons." )
# Server specific
# Server specific.
cmd_change_password=( "pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password." )
cmd_install_default_resources=( "ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources." )
cmd_wipe=( "wi;wipe" "command_wipe.sh" "Wipe your main game server data." )
@ -44,7 +44,7 @@ cmd_install_cdkey=( "cd;server-cd-key" "install_ut2k4_key.sh" "Add your server c
cmd_install_dst_token=( "ct;cluster-token" "install_dst_token.sh" "Configure cluster token." )
cmd_install_squad_license=( "li;license" "install_squad_license.sh" "Add your Squad server license." )
cmd_fastdl=( "fd;fastdl" "command_fastdl.sh" "Build a FastDL directory." )
# Dev commands
# Dev commands.
cmd_dev_debug=( "dev;developer" "command_dev_debug.sh" "Enable developer Mode." )
cmd_dev_detect_deps=( "dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies." )
cmd_dev_detect_glibc=( "dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc." )
@ -53,48 +53,48 @@ cmd_dev_query_raw=( "qr;query-raw" "command_dev_query_raw.sh" "The raw output of
cmd_dev_clear_functions=( "cf;clear-functions" "command_dev_clear_functions.sh" "Delete the contents of the functions dir." )
### Set specific opt here ###
### Set specific opt here.
currentopt=( "${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monitor[@]}" "${cmd_test_alert[@]}" "${cmd_details[@]}" "${cmd_postdetails[@]}" )
# Update LGSM
# Update LGSM.
currentopt+=( "${cmd_update_linuxgsm[@]}" )
# Exclude noupdate games here
# Exclude noupdate games here.
if [ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${shortname}" != "bf1942" ]&&[ "${shortname}" != "samp" ]; then
currentopt+=( "${cmd_update[@]}" )
# force update for SteamCMD only or MTA
# force update for SteamCMD only or MTA.
if [ -n "${appid}" ]||[ "${shortname}" == "mta" ]; then
currentopt+=( "${cmd_force_update[@]}" )
fi
fi
# Validate command
# Validate command.
if [ -n "${appid}" ]; then
currentopt+=( "${cmd_validate[@]}" )
fi
#Backup
#Backup.
currentopt+=( "${cmd_backup[@]}" )
# Exclude games without a console
# Exclude games without a console.
if [ "${shortname}" != "ts3" ]; then
currentopt+=( "${cmd_console[@]}" "${cmd_debug[@]}" )
fi
## Game server exclusive commands
## Game server exclusive commands.
# FastDL command
# FastDL command.
if [ "${engine}" == "source" ]; then
currentopt+=( "${cmd_fastdl[@]}" )
fi
# TeamSpeak exclusive
# TeamSpeak exclusive.
if [ "${shortname}" == "ts3" ]; then
currentopt+=( "${cmd_change_password[@]}" )
fi
# Unreal exclusive
# Unreal exclusive.
if [ "${shortname}" == "rust" ]; then
currentopt+=( "${cmd_wipe[@]}" "${cmd_wipeall[@]}" )
fi
@ -109,39 +109,39 @@ if [ "${engine}" == "unreal" ]; then
currentopt+=( "${cmd_map_compressor_u99[@]}" )
fi
# DST exclusive
# DST exclusive.
if [ "${shortname}" == "dst" ]; then
currentopt+=( "${cmd_install_dst_token[@]}" )
fi
# MTA exclusive
# MTA exclusive.
if [ "${shortname}" == "mta" ]; then
currentopt+=( "${cmd_install_default_resources[@]}" )
fi
# Squad license exclusive
# Squad license exclusive.
if [ "${shortname}" == "squad" ]; then
currentopt+=( "${cmd_install_squad_license[@]}" )
fi
## Mods commands
## Mods commands.
if [ "${engine}" == "source" ]||[ "${shortname}" == "rust" ]||[ "${shortname}" == "hq" ]||[ "${shortname}" == "sdtd" ]; then
currentopt+=( "${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}" )
fi
## Installer
## Installer.
currentopt+=( "${cmd_install[@]}" "${cmd_auto_install[@]}" )
## Developer commands
## Developer commands.
currentopt+=( "${cmd_dev_debug[@]}" )
if [ -f ".dev-debug" ]; then
currentopt+=( "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}" )
fi
## Donate
## Donate.
currentopt+=( "${cmd_donate[@]}" )
### Build list of available commands
### Build list of available commands.
optcommands=()
index="0"
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
@ -151,7 +151,7 @@ for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
done
done
# Shows LinuxGSM usage
# Shows LinuxGSM usage.
fn_opt_usage(){
echo "Usage: $0 [option]"
echo -e ""
@ -159,11 +159,11 @@ fn_opt_usage(){
echo "https://linuxgsm.com/${gameservername}"
echo -e ""
echo -e "${lightyellow}Commands${default}"
# Display available commands
# Display available commands.
index="0"
{
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
# Hide developer commands
# Hide developer commands.
if [ "${currentopt[index+2]}" != "DEVCOMMAND" ]; then
echo -e "${cyan}$(echo "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index+2]}"
fi
@ -172,20 +172,20 @@ fn_opt_usage(){
core_exit.sh
}
### Check if user commands exist and run corresponding scripts, or display script usage
# Check if user commands exist and run corresponding scripts, or display script usage.
if [ -z "${getopt}" ]; then
fn_opt_usage
fi
# Command exists
# Command exists.
for i in "${optcommands[@]}"; do
if [ "${i}" == "${getopt}" ] ; then
# Seek and run command
# Seek and run command.
index="0"
for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
currcmdamount="$(echo "${currentopt[index]}" | awk -F ';' '{ print NF }')"
for ((currcmdindex=1; currcmdindex <= ${currcmdamount}; currcmdindex++)); do
if [ "$(echo "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
# Run command
# Run command.
eval "${currentopt[index+1]}"
core_exit.sh
break
@ -195,7 +195,7 @@ for i in "${optcommands[@]}"; do
fi
done
# If we're executing this, it means command was not found
# If we're executing this, it means command was not found.
echo -e "${red}Unknown command${default}: $0 ${getopt}"
exitcode=2
fn_opt_usage

View File

@ -41,7 +41,7 @@ if [ -z "${alertlog}" ]; then
alertlog="${emaillog}"
fi
# Alternations to workshop variables
# Alternations to workshop variables.
if [ -z "${wsapikey}" ]; then
if [ "${workshopauth}" ]; then
wsapikey="${workshopauth}"
@ -62,4 +62,4 @@ if [ -z "${wsstartmap}" ]; then
if [ "${ws_start_map}" ]; then
wscollectionid="${ws_start_map}"
fi
fi
fi

View File

@ -5,8 +5,8 @@
# Website: https://linuxgsm.com
# Description: Defines on-screen messages such as [ OK ] and how script logs look.
# nl: new line: message is following by a new line
# eol: end of line: message is placed at the end of the current line
# nl: new line: message is following by a new line.
# eol: end of line: message is placed at the end of the current line.
fn_ansi_loader(){
if [ "${ansi}" != "off" ]; then
# echo colors
@ -24,7 +24,7 @@ fn_ansi_loader(){
cyan="\e[36m"
lightcyan="\e[96m"
fi
# carriage return & erase to end of line
# carriage return & erase to end of line.
creeol="\r\033[K"
}

View File

@ -8,7 +8,7 @@
local commandname="FIX"
local commandaction="Fix"
# Messages that are displayed for some fixes
# Messages that are displayed for some fixes.
fn_fix_msg_start(){
fn_print_dots "Applying ${fixname} fix: ${gamename}"
fn_print_info "Applying ${fixname} fix: ${gamename}"
@ -31,7 +31,7 @@ fn_fix_msg_end(){
fi
}
# Fixes that are run on start
# Fixes that are run on start.
if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; then
if [ -n "${appid}" ]; then
fix_steamcmd.sh

View File

@ -7,6 +7,5 @@
local commandname="FIX"
local commandaction="Fix"
# Force glibc fix
# Force glibc fix.
fix_glibc.sh

View File

@ -8,7 +8,7 @@ local commandname="FIX"
local commandaction="Fix"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer)
# Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer).
# Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.
if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" ]; then
fixname="libcurl-gnutls.so.4"

View File

@ -7,5 +7,5 @@
local commandname="FIX"
local commandaction="Fix"
# Fixes: [Raknet] Server Shutting Down (Shutting Down)
# Fixes: [Raknet] Server Shutting Down (Shutting Down).
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${systemdir}/RustDedicated_Data/Plugins/x86_64"

View File

@ -8,10 +8,10 @@ local commandname="FIX"
local commandaction="Fix"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Fixes: makes libmariadb2 available #1924
# Fixes: makes libmariadb2 available #1924.
if [ ! -f "${serverfiles}/libmariadb.so.2" ]; then
fixname="libmariadb.so.2"
fn_fix_msg_start
cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}/libmariadb.so.2"
fn_fix_msg_end
fn_fix_msg_end
fi

View File

@ -7,5 +7,5 @@
local commandname="FIX"
local commandaction="Fix"
# Fixes: [Raknet] Server Shutting Down (Shutting Down)
# Fixes: [Raknet] Server Shutting Down (Shutting Down).
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${systemdir}/lib"

View File

@ -4,13 +4,13 @@
# Website: https://linuxgsm.com
# Description: Resolves various issues with ARK: Survival Evolved.
# Copies steamclient.so to correct location
# Copies steamclient.so to correct location.
if [ ! -f "${serverfiles}/nativelibs" ]; then
cp -f "${serverfiles}/linux64/steamclient.so" "${serverfiles}/nativelibs"
fi
# First run requires start with no parms
# After first run new dirs are created
# First run requires start with no parms.
# After first run new dirs are created.
if [ ! -d "${serverfiles}/Creative" ]; then
parmsbypass=1
fixbypass=1
@ -20,4 +20,4 @@ if [ ! -d "${serverfiles}/Creative" ]; then
exitbypass=1
command_stop.sh
unset parmsbypass
fi
fi

View File

@ -7,7 +7,7 @@
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
## Examples of filtering to get info from config files
## Examples of filtering to get info from config files.
# sed 's/foo//g' - remove foo
# tr -cd '[:digit:]' leave only digits
# tr -d '=\"; ' remove selected characters =\";

View File

@ -19,7 +19,7 @@ kernel=$(uname -r)
# Distro ID - ubuntu
# Distro Codename - xenial
# Gathers distro info from various sources filling in missing gaps
# Gathers distro info from various sources filling in missing gaps.
distro_info_array=( os-release lsb_release hostnamectl debian_version redhat-release )
for distro_info in "${distro_info_array[@]}"
do
@ -97,18 +97,18 @@ cpufreuency=$(awk -F: ' /cpu MHz/ {freq=$2} END {print freq " MHz"}' /proc/cpuin
## Memory information
# Available RAM and swap.
# Newer distros can use numfmt to give more accurate results
# Newer distros can use numfmt to give more accurate results.
if [ -n "$(command -v numfmt 2>/dev/null)" ]; then
# Issue #2005 - Kernel 3.14+ contains MemAvailable which should be used. All others will be calculated
# Issue #2005 - Kernel 3.14+ contains MemAvailable which should be used. All others will be calculated.
# get the raw KB values of these fields
# get the raw KB values of these fields.
physmemtotalkb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
physmemfreekb=$(grep ^MemFree /proc/meminfo | awk '{print $2}')
physmembufferskb=$(grep ^Buffers /proc/meminfo | awk '{print $2}')
physmemcachedkb=$(grep ^Cached /proc/meminfo | awk '{print $2}')
physmemreclaimablekb=$(grep ^SReclaimable /proc/meminfo | awk '{print $2}')
# check if MemAvailable Exists
# check if MemAvailable Exists.
if grep -q ^MemAvailable /proc/meminfo; then
physmemactualfreekb=$(grep ^MemAvailable /proc/meminfo | awk '{print $2}')
else
@ -183,12 +183,12 @@ fi
if [ -d "${backupdir}" ]; then
# Used space in backups dir.
backupdirdu=$(du -sh "${backupdir}" | awk '{print $1}')
# If no backup dir, size is 0M
# If no backup dir, size is 0M.
if [ -z "${backupdirdu}" ]; then
backupdirdu="0M"
fi
# number of backups set to 0 by default
# number of backups set to 0 by default.
backupcount=0
# If there are backups in backup dir.
@ -210,7 +210,7 @@ fi
if [ -z "${extip}" ]; then
extip=$(${curlpath} -4 -m 3 ifconfig.co 2>/dev/null)
exitcode=$?
# Should ifconfig.co return an error will use last known IP
# Should ifconfig.co return an error will use last known IP.
if [ ${exitcode} -eq 0 ]; then
echo "${extip}" > "${tmpdir}/extip.txt"
else
@ -231,7 +231,7 @@ else
alertip="${ip}"
fi
# Steam Master Server - checks if detected by master server
# Steam Master Server - checks if detected by master server.
if [ "$(command -v jq 2>/dev/null)" ]; then
if [ "${ip}" ]&&[ "${port}" ]; then
if [ "${steammaster}" == "true" ]; then

View File

@ -8,7 +8,7 @@ local commandname="INSTALL"
local commandaction="Install"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Checks if server cfg dir exists, creates it if it doesn't
# Checks if server cfg dir exists, creates it if it doesn't.
fn_check_cfgdir(){
if [ ! -d "${servercfgdir}" ]; then
echo "creating ${servercfgdir} config directory."
@ -17,7 +17,7 @@ fn_check_cfgdir(){
fi
}
# Downloads default configs from Game-Server-Configs repo to lgsm/config-default
# Downloads default configs from Game-Server-Configs repo to lgsm/config-default.
fn_fetch_default_config(){
echo ""
echo "Downloading ${gamename} Configs"
@ -31,7 +31,7 @@ fn_fetch_default_config(){
done
}
# Copys default configs from Game-Server-Configs repo to server config location
# Copys default configs from Game-Server-Configs repo to server config location.
fn_default_config_remote(){
for config in "${array_configs[@]}"; do
# every config is copied
@ -53,14 +53,14 @@ fn_default_config_remote(){
fn_sleep_time
}
# Copys local default config to server config location
# Copys local default config to server config location.
fn_default_config_local(){
echo "copying ${servercfgdefault} config file."
cp -nv "${servercfgfullpathdefault}" "${servercfgfullpath}"
fn_sleep_time
}
# Changes some variables within the default configs
# Changes some variables within the default configs.
# SERVERNAME to LinuxGSM
# PASSWORD to random password
fn_set_config_vars(){
@ -71,7 +71,7 @@ fn_set_config_vars(){
echo "changing hostname."
fn_script_log_info "changing hostname."
fn_sleep_time
# prevents var from being overwritten with the servername
# prevents var from being overwritten with the servername.
if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2>/dev/null; then
sed -i "s/SERVERNAME=SERVERNAME/SERVERNAME=${servername}/g" "${servercfgfullpath}"
elif grep -q "SERVERNAME=\"SERVERNAME\"" "${lgsmdir}/config-default/config-game/${config}" 2>/dev/null; then
@ -94,7 +94,7 @@ fn_set_config_vars(){
fi
}
# Changes some variables within the default Don't Starve Together configs
# Changes some variables within the default Don't Starve Together configs.
fn_set_dst_config_vars(){
## cluster.ini
if grep -Fq "SERVERNAME" "${clustercfgfullpath}"; then
@ -117,7 +117,7 @@ fn_set_dst_config_vars(){
fi
## server.ini
# removing unnecessary options (dependent on sharding & shard type)
# removing unnecessary options (dependent on sharding & shard type).
if [ "${sharding}" == "false" ]; then
sed -i "s/ISMASTER//g" "${servercfgfullpath}"
sed -i "/SHARDNAME/d" "${servercfgfullpath}"

View File

@ -14,7 +14,7 @@ if [ "${checklogs}" != "1" ]; then
echo "================================="
fi
fn_sleep_time
# Create LinuxGSM logs
# Create LinuxGSM logs.
echo -en "installing log dir: ${logdir}..."
mkdir -p "${logdir}"
if [ $? -ne 0 ]; then
@ -40,7 +40,7 @@ if [ $? -ne 0 ]; then
else
fn_print_ok_eol_nl
fi
# Create Console logs
# Create Console logs.
if [ -n "${consolelogdir}" ]; then
echo -en "installing console log dir: ${consolelogdir}..."
mkdir -p "${consolelogdir}"
@ -60,7 +60,7 @@ if [ -n "${consolelogdir}" ]; then
fi
fi
# Create Game logs
# Create Game logs.
if [ -n "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then
echo -en "installing game log dir: ${gamelogdir}..."
mkdir -p "${gamelogdir}"
@ -73,7 +73,7 @@ if [ -n "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then
fi
# Symlink to gamelogdir
# unless gamelogdir is within logdir
# unless gamelogdir is within logdir.
# e.g serverfiles/log is not within log/: symlink created
# log/server is in log/: symlink not created
if [ -n "${gamelogdir}" ]; then
@ -89,7 +89,7 @@ if [ -n "${gamelogdir}" ]; then
fi
fi
# If server uses SteamCMD create a symbolic link to the Steam logs
# If server uses SteamCMD create a symbolic link to the Steam logs.
if [ -d "${rootdir}/Steam/logs" ]; then
if [ ! -L "${logdir}/steamcmd" ]; then
echo -en "creating symlink to steam log dir: ${logdir}/steamcmd -> ${rootdir}/Steam/logs..."

View File

@ -64,11 +64,11 @@ fn_install_server_files_steamcmd(){
counter=$((counter+1))
cd "${steamcmddir}"
if [ "${counter}" -le "10" ]; then
# Attempt 1-4: Standard attempt
# Attempt 5-6: Validate attempt
# Attempt 7-8: Validate, delete long name dir
# Attempt 9-10: Validate, delete long name dir, re-download SteamCMD
# Attempt 11: Failure
# Attempt 1-4: Standard attempt.
# Attempt 5-6: Validate attempt.
# Attempt 7-8: Validate, delete long name dir.
# Attempt 9-10: Validate, delete long name dir, re-download SteamCMD.
# Attempt 11: Failure.
if [ "${counter}" -ge "2" ]; then
fn_print_warning_nl "SteamCMD did not complete the download, retrying: Attempt ${counter}"

View File

@ -65,7 +65,6 @@ fi
install_eula.sh
## Get privilege key
echo ""
echo "Getting privilege key"
echo "================================="

View File

@ -8,14 +8,14 @@
local commandname="LOGS"
local commandaction="Log-Manager"
# Check if logfile variable and file exist, create logfile if it doesn't exist
# Check if logfile variable and file exist, create logfile if it doesn't exist.
if [ -n "${consolelog}" ]; then
if [ ! -e "${consolelog}" ]; then
touch "${consolelog}"
fi
fi
# For games not displaying a console, and having logs into their game directory
# For games not displaying a console, and having logs into their game directory.
check_status.sh
if [ "${status}" != "0" ]&&[ "${function_selfname}" == "command_start.sh" ]&&[ -n "${gamelogfile}" ]; then
if [ -n "$(find "${systemdir}" -name "gamelog*.log")" ]; then
@ -27,7 +27,7 @@ if [ "${status}" != "0" ]&&[ "${function_selfname}" == "command_start.sh" ]&&[ -
fi
fi
# Log manager will start the cleanup if it finds logs older than "${logdays}"
# Log manager will start the cleanup if it finds logs older than "${logdays}".
if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) -ne "0" ]; then
fn_print_dots "Starting"
# Set common logs directories
@ -44,24 +44,24 @@ if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) -ne "0" ]; th
fn_print_ok_nl "Starting"
fn_print_info_nl "Removing logs older than ${logdays} days"
fn_script_log_info "Removing logs older than ${logdays} days"
# Logging logfiles to be removed according to "${logdays}", counting and removing them
# Script logfiles
# Logging logfiles to be removed according to "${logdays}", counting and removing them.
# Script logfiles.
find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
scriptcount=$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${lgsmlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
# SRCDS and unreal logfiles
# SRCDS and unreal logfiles.
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
find "${gamelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Console logfiles
# Console logfiles.
if [ -n "${consolelog}" ]; then
find "${consolelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Common logfiles
# Common logfiles.
if [ -d "${commonlogs}" ]; then
find "${commonlogs}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
smcount=$(find "${commonlogs}"/ -type f -mtime +"${logdays}" | wc -l)
@ -72,23 +72,23 @@ if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) -ne "0" ]; th
smcount=$(find "${commonsourcelogs}"/* -type f -mtime +"${logdays}" | wc -l)
find "${commonsourcelogs}"/* -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Source addons logfiles
# Source addons logfiles.
if [ "${engine}" == "source" ]; then
# SourceMod logfiles
# SourceMod logfiles.
if [ -d "${sourcemodlogdir}" ]; then
find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# Garry's Mod logfiles
# Garry's Mod logfiles.
if [ "${gamename}" == "Garry's Mod" ]; then
# ULX logfiles
# ULX logfiles.
if [ -d "${ulxlogdir}" ]; then
find "${ulxlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}" | wc -l)
find "${ulxlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
fi
# DarkRP logfiles
# DarkRP logfiles.
if [ -d "${darkrplogdir}" ]; then
find "${darkrplogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}" | wc -l)
@ -97,9 +97,9 @@ if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) -ne "0" ]; th
fi
fi
# Count total amount of files removed
# Count total amount of files removed.
countlogs=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount}))
# Job done
# Job done.
fn_print_ok_nl "Removed ${countlogs} log files"
fn_script_log "Removed ${countlogs} log files"
fi

View File

@ -9,19 +9,19 @@ local commandname="MODS"
local commandaction="Mods"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Files and Directories
# Files and Directories.
modsdir="${lgsmdir}/mods"
modstmpdir="${modsdir}/tmp"
extractdir="${modstmpdir}/extract"
modsinstalledlist="installed-mods.txt"
modsinstalledlistfullpath="${modsdir}/${modsinstalledlist}"
## Installation
## Installation.
# Download management
# Download management.
fn_mod_install_files(){
fn_fetch_file "${modurl}" "${modstmpdir}" "${modfilename}"
# Check if variable is valid checking if file has been downloaded and exists
# Check if variable is valid checking if file has been downloaded and exists.
if [ ! -f "${modstmpdir}/${modfilename}" ]; then
fn_print_failure "An issue occurred downloading ${modprettyname}"
fn_script_log_fatal "An issue occurred downloading ${modprettyname}"
@ -33,7 +33,7 @@ fn_mod_install_files(){
fn_dl_extract "${modstmpdir}" "${modfilename}" "${extractdir}"
}
# Convert mod files to lowercase if needed
# Convert mod files to lowercase if needed.
fn_mod_lowercase(){
if [ "${modlowercase}" == "LowercaseOn" ]; then
@ -65,11 +65,11 @@ fn_mod_lowercase(){
fi
}
# Create ${modcommand}-files.txt containing the full extracted file/directory list
# Create ${modcommand}-files.txt containing the full extracted file/directory list.
fn_mod_create_filelist(){
echo -en "building ${modcommand}-files.txt..."
fn_sleep_time
# ${modsdir}/${modcommand}-files.txt
# ${modsdir}/${modcommand}-files.txt.
find "${extractdir}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
@ -80,14 +80,14 @@ fn_mod_create_filelist(){
fn_print_ok_eol_nl
fn_script_log_pass "Building ${modsdir}/${modcommand}-files.txt"
fi
# Adding removed files if needed
# Adding removed files if needed.
if [ -f "${modsdir}/.removedfiles.tmp" ]; then
cat "${modsdir}/.removedfiles.tmp" >> "${modsdir}/${modcommand}-files.txt"
fi
fn_sleep_time
}
# Copy the mod into serverfiles
# Copy the mod into serverfiles.
fn_mod_copy_destination(){
echo -en "copying ${modprettyname} to ${modinstalldir}..."
fn_sleep_time
@ -102,7 +102,7 @@ fn_mod_copy_destination(){
fi
}
# Add the mod to the installed-mods.txt
# Add the mod to the installed-mods.txt.
fn_mod_add_list(){
if [ ! -n "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
echo "${modcommand}" >> "${modsinstalledlistfullpath}"
@ -110,26 +110,26 @@ fn_mod_add_list(){
fi
}
# Prevent sensitive directories from being erased upon uninstall by removing them from: ${modcommand}-files.txt
# Prevent sensitive directories from being erased upon uninstall by removing them from: ${modcommand}-files.txt.
fn_mod_tidy_files_list(){
# Check file list validity
# Check file list validity.
fn_check_mod_files_list
# Output to the user
echo -en "tidy up ${modcommand}-files.txt..."
fn_sleep_time
fn_script_log_info "Tidy up ${modcommand}-files.txt"
# Lines/files to remove from file list (end with ";" separator)
# Lines/files to remove from file list (end with ";" separator).
removefromlist="cfg;addons;RustDedicated_Data;RustDedicated_Data\/Managed;RustDedicated_Data\/Managed\/x86;RustDedicated_Data\/Managed\/x64;"
# Loop through files to remove from file list,
# generate elements to remove from list
# generate elements to remove from list.
removefromlistamount="$(echo "${removefromlist}" | awk -F ';' '{ print NF }')"
# Test all subvalue of "removefromlist" using the ";" separator
# Test all subvalue of "removefromlist" using the ";" separator.
for ((filesindex=1; filesindex < removefromlistamount; filesindex++)); do
# Put current file into test variable
# Put current file into test variable.
removefilevar="$(echo "${removefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }')"
# Delete line(s) matching exactly
# Delete line(s) matching exactly.
sed -i "/^${removefilevar}$/d" "${modsdir}/${modcommand}-files.txt"
# Exit on error
# Exit on error.
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
@ -140,42 +140,42 @@ fn_mod_tidy_files_list(){
done
fn_print_ok_eol_nl
# Sourcemod fix
# Remove metamod from sourcemod fileslist
# Remove metamod from sourcemod fileslist.
if [ "${modcommand}" == "sourcemod" ]; then
# Remove addons/metamod & addons/metamod/sourcemod.vdf from ${modcommand}-files.txt
# Remove addons/metamod & addons/metamod/sourcemod.vdf from ${modcommand}-files.txt.
sed -i "/^addons\/metamod$/d" "${modsdir}/${modcommand}-files.txt"
sed -i "/^addons\/metamod\/sourcemod.vdf$/d" "${modsdir}/${modcommand}-files.txt"
fi
}
## Information Gathering
## Information Gathering.
# Get details of a mod any (relevant and unique, such as full mod name or install command) value
# Get details of a mod any (relevant and unique, such as full mod name or install command) value.
fn_mod_get_info(){
# Variable to know when job is done
# Variable to know when job is done.
modinfocommand="0"
# Find entry in global array
# Find entry in global array.
for ((index=0; index <= ${#mods_global_array[@]}; index++)); do
# When entry is found
# When entry is found.
if [ "${mods_global_array[index]}" == "${currentmod}" ]; then
# Go back to the previous "MOD" separator
# Go back to the previous "MOD" separator.
for ((index=index; index <= ${#mods_global_array[@]}; index--)); do
# When "MOD" is found
# When "MOD" is found.
if [ "${mods_global_array[index]}" == "MOD" ]; then
# Get info
# Get info.
fn_mods_define
modinfocommand="1"
break
fi
done
fi
# Exit the loop if job is done
# Exit the loop if job is done.
if [ "${modinfocommand}" == "1" ]; then
break
fi
done
# What happens if mod is not found
# What happens if mod is not found.
if [ "${modinfocommand}" == "0" ]; then
fn_script_log_error "Could not find information for ${currentmod}"
fn_print_error_nl "Could not find information for ${currentmod}"
@ -183,7 +183,7 @@ fn_mod_get_info(){
fi
}
# Define all variables for a mod at once when index is set to a separator
# Define all variables for a mod at once when index is set to a separator.
fn_mods_define(){
if [ -z "$index" ]; then
fn_script_log_fatal "index variable not set. Please report an issue."
@ -206,25 +206,25 @@ fi
moddescription="${mods_global_array[index+13]}"
}
# Builds list of installed mods
# using installed-mods.txt grabing mod info from mods_list.sh
# Builds list of installed mods.
# using installed-mods.txt grabing mod info from mods_list.sh.
fn_mods_installed_list(){
fn_mods_count_installed
# Set/reset variables
# Set/reset variables.
installedmodsline="1"
installedmodslist=()
modprettynamemaxlength="0"
modsitemaxlength="0"
moddescriptionmaxlength="0"
modcommandmaxlength="0"
# Loop through every line of the installed mods list ${modsinstalledlistfullpath}
# Loop through every line of the installed mods list ${modsinstalledlistfullpath}.
while [ "${installedmodsline}" -le "${installedmodscount}" ]; do
currentmod="$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")"
# Get mod info to make sure mod exists
# Get mod info to make sure mod exists.
fn_mod_get_info
# Add the mod to available commands
# Add the mod to available commands.
installedmodslist+=( "${modcommand}" )
# Increment line check
# Increment line check.
((installedmodsline++))
done
if [ -n "${installedmodscount}" ]; then
@ -232,99 +232,99 @@ fn_mods_installed_list(){
fi
}
# Loops through mods_global_array to define available mods & provide available commands for mods installation
# Loops through mods_global_array to define available mods & provide available commands for mods installation.
fn_mods_available(){
# First, reset variables
# First, reset variables.
compatiblemodslist=()
availablemodscommands=()
# Find compatible games
# Find separators through the global array
# Find compatible games.
# Find separators through the global array.
for ((index="0"; index <= ${#mods_global_array[@]}; index++)); do
# If current value is a separator; then
# If current value is a separator; then.
if [ "${mods_global_array[index]}" == "${modseparator}" ]; then
# Set mod variables
# Set mod variables.
fn_mods_define
# Test if game is compatible
# Test if game is compatible.
fn_mod_compatible_test
# If game is compatible
# If game is compatible.
if [ "${modcompatibility}" == "1" ]; then
# Put it into an array to prepare user output
# Put it into an array to prepare user output.
compatiblemodslist+=( "${modprettyname}" "${modcommand}" "${modsite}" "${moddescription}" )
# Keep available commands in an array to make life easier
# Keep available commands in an array to make life easier.
availablemodscommands+=( "${modcommand}" )
fi
fi
done
}
## Mod compatibility check
## Mod compatibility check.
# Find out if a game is compatible with a mod from a modgames (list of games supported by a mod) variable
# Find out if a game is compatible with a mod from a modgames (list of games supported by a mod) variable.
fn_compatible_mod_games(){
# Reset test value
# Reset test value.
modcompatiblegame="0"
# If value is set to GAMES (ignore)
# If value is set to GAMES (ignore).
if [ "${modgames}" != "GAMES" ]; then
# How many games we need to test
# How many games we need to test.
gamesamount="$(echo "${modgames}" | awk -F ';' '{ print NF }')"
# Test all subvalue of "modgames" using the ";" separator
# Test all subvalue of "modgames" using the ";" separator.
for ((gamevarindex=1; gamevarindex < gamesamount; gamevarindex++)); do
# Put current game name into modtest variable
# Put current game name into modtest variable.
gamemodtest="$( echo "${modgames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
# If game name matches
# If game name matches.
if [ "${gamemodtest}" == "${gamename}" ]; then
# Mod is compatible !
# Mod is compatible.
modcompatiblegame="1"
fi
done
fi
}
# Find out if an engine is compatible with a mod from a modengines (list of engines supported by a mod) variable
# Find out if an engine is compatible with a mod from a modengines (list of engines supported by a mod) variable.
fn_compatible_mod_engines(){
# Reset test value
# Reset test value.
modcompatibleengine="0"
# If value is set to ENGINES (ignore)
# If value is set to ENGINES (ignore).
if [ "${modengines}" != "ENGINES" ]; then
# How many engines we need to test
# How many engines we need to test.
enginesamount="$(echo "${modengines}" | awk -F ';' '{ print NF }')"
# Test all subvalue of "modengines" using the ";" separator
# Test all subvalue of "modengines" using the ";" separator.
for ((gamevarindex=1; gamevarindex < ${enginesamount}; gamevarindex++)); do
# Put current engine name into modtest variable
# Put current engine name into modtest variable.
enginemodtest="$( echo "${modengines}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
# If engine name matches
# If engine name matches.
if [ "${enginemodtest}" == "${engine}" ]; then
# Mod is compatible!
# Mod is compatible.
modcompatibleengine="1"
fi
done
fi
}
# Find out if a game is not compatible with a mod from a modnotgames (list of games not supported by a mod) variable
# Find out if a game is not compatible with a mod from a modnotgames (list of games not supported by a mod) variable.
fn_not_compatible_mod_games(){
# Reset test value
# Reset test value.
modeincompatiblegame="0"
# If value is set to NOTGAMES (ignore)
# If value is set to NOTGAMES (ignore).
if [ "${modexcludegames}" != "NOTGAMES" ]; then
# How many engines we need to test
# How many engines we need to test.
excludegamesamount="$(echo "${modexcludegames}" | awk -F ';' '{ print NF }')"
# Test all subvalue of "modexcludegames" using the ";" separator
# Test all subvalue of "modexcludegames" using the ";" separator.
for ((gamevarindex=1; gamevarindex < excludegamesamount; gamevarindex++)); do
# Put current engine name into modtest variable
# Put current engine name into modtest variable.
excludegamemodtest="$( echo "${modexcludegames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
# If engine name matches
# If engine name matches.
if [ "${excludegamemodtest}" == "${gamename}" ]; then
# Mod is compatible!
# Mod is compatible.
modeincompatiblegame="1"
fi
done
fi
}
# Sums up if a mod is compatible or not with modcompatibility=0/1
# Sums up if a mod is compatible or not with modcompatibility=0/1.
fn_mod_compatible_test(){
# Test game and engine compatibility
# Test game and engine compatibility.
fn_compatible_mod_games
fn_compatible_mod_engines
fn_not_compatible_mod_games
@ -337,11 +337,11 @@ fn_mod_compatible_test(){
fi
}
## Directory management
## Directory management.
# Create mods files and directories if it doesn't exist
# Create mods files and directories if it doesn't exist.
fn_create_mods_dir(){
# Create lgsm data modsdir
# Create lgsm data modsdir.
if [ ! -d "${modsdir}" ]; then
echo -en "creating LinuxGSM mods data directory ${modsdir}..."
mkdir -p "${modsdir}"
@ -356,7 +356,7 @@ fn_create_mods_dir(){
fi
fn_sleep_time
fi
# Create mod install directory
# Create mod install directory.
if [ ! -d "${modinstalldir}" ]; then
echo -en "creating mods install directory ${modinstalldir}..."
mkdir -p "${modinstalldir}"
@ -372,14 +372,14 @@ fn_create_mods_dir(){
fn_sleep_time
fi
# Create lgsm/data/${modsinstalledlist}
# Create lgsm/data/${modsinstalledlist}.
if [ ! -f "${modsinstalledlistfullpath}" ]; then
touch "${modsinstalledlistfullpath}"
fn_script_log_info "Created ${modsinstalledlistfullpath}"
fi
}
# Create tmp download mod directory
# Create tmp download mod directory.
fn_mods_create_tmp_dir(){
if [ ! -d "${modstmpdir}" ]; then
mkdir -p "${modstmpdir}"
@ -396,7 +396,7 @@ fn_mods_create_tmp_dir(){
fi
}
# Remove the tmp mod download directory when finished
# Remove the tmp mod download directory when finished.
fn_mods_clear_tmp_dir(){
if [ -d "${modstmpdir}" ]; then
echo -en "clearing mod download directory ${modstmpdir}..."
@ -412,13 +412,13 @@ fn_mods_clear_tmp_dir(){
fi
fi
# Clear temp file list as well
# Clear temp file list as well.
if [ -f "${modsdir}/.removedfiles.tmp" ]; then
rm "${modsdir}/.removedfiles.tmp"
fi
}
# Counts how many mods were installed
# Counts how many mods were installed.
fn_mods_count_installed(){
if [ -f "${modsinstalledlistfullpath}" ]; then
installedmodscount="$(wc -l < "${modsinstalledlistfullpath}")"
@ -427,11 +427,11 @@ fn_mods_count_installed(){
fi
}
# Exits if no mods were installed
# Exits if no mods were installed.
fn_mods_check_installed(){
# Count installed mods
# Count installed mods.
fn_mods_count_installed
# If no mods are found
# If no mods are found.
if [ ${installedmodscount} -eq 0 ]; then
echo ""
fn_print_failure_nl "No installed mods or addons were found"
@ -441,13 +441,13 @@ fn_mods_check_installed(){
fi
}
# Checks that mod files list exists and isn't empty
# Checks that mod files list exists and isn't empty.
fn_check_mod_files_list(){
# File list must exist and be valid before any operation on it
# File list must exist and be valid before any operation on it.
if [ -f "${modsdir}/${modcommand}-files.txt" ]; then
# How many lines is the file list
# How many lines is the file list.
modsfilelistsize="$(wc -l < "${modsdir}/${modcommand}-files.txt")"
# If file list is empty
# If file list is empty.
if [ "${modsfilelistsize}" -eq 0 ]; then
fn_print_failure "${modcommand}-files.txt is empty"
echo "* Unable to remove ${modprettyname}"
@ -461,7 +461,7 @@ fn_check_mod_files_list(){
fi
}
## Database initialisation
## Database initialisation.
mods_list.sh
fn_mods_available

View File

@ -5,7 +5,7 @@
# Description: Querys a gameserver using node-gamedig.
# https://github.com/sonicsnes/node-gamedig
#Check if gamedig and jq are installed
# Check if gamedig and jq are installed.
if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then
if [ "${engine}" == "idtech3_ql" ]; then
@ -78,56 +78,56 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
fi
done
# will bypass query if server offline
# will bypass query if server offline.
check_status.sh
if [ "${status}" != "0" ]; then
# checks if query is working null = pass
# checks if query is working null = pass.
gamedigcmd=$(echo "gamedig --type \"${gamedigengine}\" --host \"${ip}\" --query_port \"${queryport}\"|jq")
gamedigraw=$(gamedig --type "${gamedigengine}" --host "${ip}" --query_port "${queryport}")
querystatus=$(echo "${gamedigraw}" | jq '.error|length')
if [ "${querystatus}" != "null" ]; then
gamedigcmd=$(echo "gamedig --type \"${gamedigengine}\" --host \"${ip}\" --port \"${queryport}\"|jq")
gamedigraw=$(gamedig --type "${gamedigengine}" --host "${ip}" --port "${queryport}")
querystatus=$(echo "${gamedigraw}" | jq '.error|length')
fi
# server name
fi
# server name.
gdname=$(echo "${gamedigraw}" | jq -re '.name')
if [ "${gdname}" == "null" ]; then
unset gdname
fi
# numplayers
# numplayers.
gdplayers=$(echo "${gamedigraw}" | jq -re '.players|length')
if [ "${gdplayers}" == "null" ]; then
unset gdplayers
fi
# maxplayers
# maxplayers.
gdmaxplayers=$(echo "${gamedigraw}" | jq -re '.maxplayers|length')
if [ "${gdmaxplayers}" == "null" ]; then
unset maxplayers
fi
# current map
# current map.
gdmap=$(echo "${gamedigraw}" | jq -re '.map')
if [ "${gdmap}" == "null" ]; then
unset gdmap
fi
# current gamemode
# current gamemode.
gdgamemode=$(echo "${gamedigraw}" | jq -re '.raw.rules.GameMode_s')
if [ "${gdgamemode}" == "null" ]; then
unset gdgamemode
fi
# numbots
# numbots.
gdbots=$(echo "${gamedigraw}" | jq -re '.raw.numbots')
if [ "${gdbots}" == "null" ]||[ "${gdbots}" == "0" ]; then
unset gdbots
fi
fi
fi
fi

View File

@ -25,7 +25,7 @@ shortname="core"
gameservername="core"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
servicename="${selfname}"
servicename="${gameservername}"
lockselfname=".${servicename}.lock"
lgsmdir="${rootdir}/lgsm"
logdir="${rootdir}/log"
@ -35,6 +35,9 @@ serverfiles="${rootdir}/serverfiles"
functionsdir="${lgsmdir}/functions"
libdir="${lgsmdir}/lib"
tmpdir="${lgsmdir}/tmp"
datadir="${lgsmdir}/data"
serverlist="${datadir}/serverlist.csv"
serverlistmenu="${datadir}/serverlistmenu.csv"
configdir="${lgsmdir}/config-lgsm"
configdirserver="${configdir}/${gameservername}"
configdirdefault="${lgsmdir}/config-default"
@ -47,16 +50,16 @@ githubuser="GameServerManagers"
githubrepo="LinuxGSM"
githubbranch="master"
# Core Function that is required first
# Core function that is required first.
core_functions.sh(){
functionfile="${FUNCNAME}"
fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
}
# Bootstrap
# Fetches the core functions required before passed off to core_dl.sh
# Fetches the core functions required before passed off to core_dl.sh.
# Fetches core functions
# Fetches core functions.
fn_bootstrap_fetch_file(){
remote_fileurl="${1}"
local_filedir="${2}"
@ -65,17 +68,17 @@ fn_bootstrap_fetch_file(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# download file if missing or download forced
# Download file if missing or download forced.
if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
if [ ! -d "${local_filedir}" ]; then
mkdir -p "${local_filedir}"
fi
# Defines curl path
# Defines curl path.
curlpath=$(command -v curl 2>/dev/null)
# If curl exists download file
# If curl exists download file.
if [ "$(basename "${curlpath}")" == "curl" ]; then
# trap to remove part downloaded files
# Trap to remove part downloaded files.
echo -en " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
local exitcode=$?
@ -93,14 +96,14 @@ fn_bootstrap_fetch_file(){
echo "[ FAIL ] Curl is not installed"
exit 1
fi
# make file chmodx if chmodx is set
# Make file chmodx if chmodx is set.
if [ "${chmodx}" == "chmodx" ]; then
chmod +x "${local_filedir}/${local_filename}"
fi
fi
if [ -f "${local_filedir}/${local_filename}" ]; then
# run file if run is set
# Run file if run is set.
if [ "${run}" == "run" ]; then
source "${local_filedir}/${local_filename}"
fi
@ -119,11 +122,11 @@ fn_bootstrap_fetch_file_github(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# Passes vars to the file download function
# Passes vars to the file download function.
fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
}
# Installer menu
# Installer menu.
fn_print_center() {
columns="$(tput cols)"
@ -136,7 +139,7 @@ fn_print_horizontal(){
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
}
# Bash Menu
# Bash menu.
fn_install_menu_bash() {
local resultvar=$1
title=$2
@ -160,7 +163,7 @@ fn_install_menu_bash() {
done
}
# Whiptail/Dialog Menu
# Whiptail/Dialog menu.
fn_install_menu_whiptail() {
local menucmd=$1
local resultvar=$2
@ -175,7 +178,7 @@ fn_install_menu_whiptail() {
while read -r line; do
key=$(echo "${line}" | awk -F "," '{print $3}')
val=$(echo "${line}" | awk -F "," '{print $2}')
menu_options+=( ${val//\"} "${key//\"}" )
menu_options+=( "${val//\"}" "${key//\"}" )
done < "${options}"
OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
if [ $? == 0 ]; then
@ -185,14 +188,14 @@ fn_install_menu_whiptail() {
fi
}
# Menu selector
# Menu selector.
fn_install_menu() {
local resultvar=$1
local selection=""
title=$2
caption=$3
options=$4
# Get menu command
# Get menu command.
for menucmd in whiptail dialog bash; do
if [ -x "$(command -v "${menucmd}")" ]; then
menucmd=$(command -v "${menucmd}")
@ -208,7 +211,7 @@ fn_install_menu() {
eval "$resultvar=\"${selection}\""
}
# Gets server info from serverlist.csv and puts in to array
# Gets server info from serverlist.csv and puts in to array.
fn_server_info(){
IFS=","
server_info_array=($(grep -aw "${userinput}" "${serverlist}"))
@ -226,7 +229,7 @@ fn_install_getopt(){
echo -e ""
echo -e "Commands"
echo -e "install\t\t| Select server to install."
echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install."
echo -e "servername\t| Enter name of game server to install. e.g $0 csgoserver."
echo -e "list\t\t| List all servers available for install."
exit
}
@ -271,25 +274,23 @@ if [ "$(whoami)" == "root" ]; then
fi
fi
# LinuxGSM installer mode
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
# LinuxGSM installer mode.
if [ "${shortname}" == "core" ]; then
datadir="${tmpdir}/data"
serverlist="${datadir}/serverlist.csv"
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
if [ "${userinput}" == "list" ]; then
if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then
{
awk -F "," '{print $2 "\t" $3}' "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}'
} | column -s $'\t' -t | more
exit
elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then
fn_install_menu result "LinuxGSM" "Select game to install" "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}"
fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}"
userinput="${result}"
fn_server_info
if [ "${result}" == "${gameservername}" ]; then
@ -312,11 +313,11 @@ if [ "${shortname}" == "core" ]; then
fn_install_getopt
fi
# LinuxGSM Server Mode
# LinuxGSM server mode.
else
core_functions.sh
if [ "${shortname}" != "core-dep" ]; then
# Load LinuxGSM configs
# Load LinuxGSM configs.
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
@ -350,14 +351,14 @@ else
fi
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it
# Load the common.cfg config. If missing download it.
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it
# Load the instance.cfg config. If missing download it.
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
@ -365,14 +366,14 @@ else
source "${configdirserver}/${servicename}.cfg"
fi
# Load the linuxgsm.sh in to tmpdir. If missing download it
# Load the linuxgsm.sh in to tmpdir. If missing download it.
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
fi
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
fn_ansi_loader
# Prevents running of core_exit.sh for Travis.
# Prevents running of core_exit.sh for Travis-CI.
if [ "${travistest}" != "1" ]; then
getopt=$1
core_getopt.sh

View File

@ -3,12 +3,25 @@
# Author: Daniel Gibbs
# License: MIT License, Copyright (c) 2019 Daniel Gibbs
# Purpose: Travis CI Tests: Factorio | Linux Game Server Management Script
# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
# Documentation: https://docs.linuxgsm.com/
# Contributors: https://linuxgsm.com/contrib
# Documentation: https://docs.linuxgsm.com
# Website: https://linuxgsm.com
# DO NOT EDIT THIS FILE
# LinuxGSM configuration is no longer edited here
# To update your LinuxGSM config go to:
# lgsm/config-lgsm
# https://docs.linuxgsm.com/configuration/linuxgsm-config
# Debugging
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
travistest="1"
version="180409"
version="v19.6.0"
shortname="fctr"
gameservername="fctrserver"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
@ -23,9 +36,13 @@ serverfiles="${rootdir}/serverfiles"
functionsdir="${lgsmdir}/functions"
libdir="${lgsmdir}/lib"
tmpdir="${lgsmdir}/tmp"
datadir="${lgsmdir}/data"
serverlist="${datadir}/serverlist.csv"
serverlistmenu="${datadir}/serverlistmenu.csv"
configdir="${lgsmdir}/config-lgsm"
configdirserver="${configdir}/${gameservername}"
configdirdefault="${lgsmdir}/config-default"
userinput="${1}"
# Allows for testing not on Travis CI
if [ ! -v TRAVIS ]; then
@ -40,16 +57,16 @@ githubuser="GameServerManagers"
githubrepo="LinuxGSM"
githubbranch="${TRAVIS_BRANCH}"
# Core Function that is required first
# Core function that is required first.
core_functions.sh(){
functionfile="${FUNCNAME}"
fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
}
# Bootstrap
# Fetches the core functions required before passed off to core_dl.sh
# Fetches the core functions required before passed off to core_dl.sh.
# Fetches core functions
# Fetches core functions.
fn_bootstrap_fetch_file(){
remote_fileurl="${1}"
local_filedir="${2}"
@ -58,42 +75,42 @@ fn_bootstrap_fetch_file(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# download file if missing or download forced
# Download file if missing or download forced.
if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
if [ ! -d "${local_filedir}" ]; then
mkdir -p "${local_filedir}"
fi
# Defines curl path
# Defines curl path.
curlpath=$(command -v curl 2>/dev/null)
# If curl exists download file
# If curl exists download file.
if [ "$(basename "${curlpath}")" == "curl" ]; then
# trap to remove part downloaded files
# Trap to remove part downloaded files.
echo -en " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then
echo -e "${remote_fileurl}" | tee -a "${lgsmlog}"
echo "${curlcmd}" | tee -a "${lgsmlog}"
fi
exit 1
else
echo -e "\e[0;32mOK\e[0m"
echo -e "OK"
fi
else
echo "[ FAIL ] Curl is not installed"
exit 1
fi
# make file chmodx if chmodx is set
# Make file chmodx if chmodx is set.
if [ "${chmodx}" == "chmodx" ]; then
chmod +x "${local_filedir}/${local_filename}"
fi
fi
if [ -f "${local_filedir}/${local_filename}" ]; then
# run file if run is set
# Run file if run is set.
if [ "${run}" == "run" ]; then
source "${local_filedir}/${local_filename}"
fi
@ -112,11 +129,11 @@ fn_bootstrap_fetch_file_github(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# Passes vars to the file download function
# Passes vars to the file download function.
fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
}
# Installer menu
# Installer menu.
fn_print_center() {
columns="$(tput cols)"
@ -129,7 +146,7 @@ fn_print_horizontal(){
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
}
# Bash Menu
# Bash menu.
fn_install_menu_bash() {
local resultvar=$1
title=$2
@ -153,7 +170,7 @@ fn_install_menu_bash() {
done
}
# Whiptail/Dialog Menu
# Whiptail/Dialog menu.
fn_install_menu_whiptail() {
local menucmd=$1
local resultvar=$2
@ -168,7 +185,7 @@ fn_install_menu_whiptail() {
while read -r line; do
key=$(echo "${line}" | awk -F "," '{print $3}')
val=$(echo "${line}" | awk -F "," '{print $2}')
menu_options+=( ${val//\"} "${key//\"}" )
menu_options+=( "${val//\"}" "${key//\"}" )
done < "${options}"
OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
if [ $? == 0 ]; then
@ -178,14 +195,14 @@ fn_install_menu_whiptail() {
fi
}
# Menu selector
# Menu selector.
fn_install_menu() {
local resultvar=$1
local selection=""
title=$2
caption=$3
options=$4
# Get menu command
# Get menu command.
for menucmd in whiptail dialog bash; do
if [ -x "$(command -v "${menucmd}")" ]; then
menucmd=$(command -v "${menucmd}")
@ -201,7 +218,7 @@ fn_install_menu() {
eval "$resultvar=\"${selection}\""
}
# Gets server info from serverlist.csv and puts in to array
# Gets server info from serverlist.csv and puts in to array.
fn_server_info(){
IFS=","
server_info_array=($(grep -aw "${userinput}" "${serverlist}"))
@ -219,7 +236,7 @@ fn_install_getopt(){
echo -e ""
echo -e "Commands"
echo -e "install\t\t| Select server to install."
echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install."
echo -e "servername\t| Enter name of game server to install. e.g $0 csgoserver."
echo -e "list\t\t| List all servers available for install."
exit
}
@ -248,9 +265,14 @@ fn_install_file(){
exit
}
# Prevent from running this script as root.
# Prevent LinuxGSM from running as root. Except if doing a dependency install.
if [ "$(whoami)" == "root" ]; then
if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then
if [ "${shortname}" == "core" ]; then
echo "[ FAIL ] Do NOT run this script as root!"
exit 1
fi
elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
echo "[ FAIL ] Do NOT run this script as root!"
exit 1
else
@ -259,26 +281,23 @@ if [ "$(whoami)" == "root" ]; then
fi
fi
# LinuxGSM installer mode
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
# LinuxGSM installer mode.
if [ "${shortname}" == "core" ]; then
userinput=$1
datadir="${tmpdir}/data"
serverlist="${datadir}/serverlist.csv"
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
if [ "${userinput}" == "list" ]; then
if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then
{
awk -F "," '{print $2 "\t" $3}' "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}'
} | column -s $'\t' -t | more
exit
elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then
fn_install_menu result "LinuxGSM" "Select game to install" "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}"
fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}"
userinput="${result}"
fn_server_info
if [ "${result}" == "${gameservername}" ]; then
@ -301,65 +320,68 @@ if [ "${shortname}" == "core" ]; then
fn_install_getopt
fi
# LinuxGSM Server Mode
# LinuxGSM server mode.
else
core_functions.sh
# Load LinuxGSM configs
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
exit 1
else
echo -e "\e[0;32mOK\e[0m"
if [ "${shortname}" != "core-dep" ]; then
# Load LinuxGSM configs.
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
else
function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo -e "FAIL"
exit 1
else
echo -e "\e[0;32mOK\e[0m"
echo -e "OK"
fi
else
function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "FAIL"
exit 1
else
echo -e "OK"
fi
fi
fi
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
else
source "${configdirserver}/${servicename}.cfg"
fi
# Load the linuxgsm.sh in to tmpdir. If missing download it
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it.
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it.
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
else
source "${configdirserver}/${servicename}.cfg"
fi
# Prevents running of core_exit.sh for Travis.
if [ -z "${travistest}" ]; then
# Load the linuxgsm.sh in to tmpdir. If missing download it.
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
fi
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
fn_ansi_loader
# Prevents running of core_exit.sh for Travis-CI.
if [ "${travistest}" != "1" ]; then
getopt=$1
core_getopt.sh
fi

View File

@ -3,12 +3,25 @@
# Author: Daniel Gibbs
# License: MIT License, Copyright (c) 2019 Daniel Gibbs
# Purpose: Travis CI Tests: Just Cause 2 | Linux Game Server Management Script
# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
# Documentation: https://docs.linuxgsm.com/
# Contributors: https://linuxgsm.com/contrib
# Documentation: https://docs.linuxgsm.com
# Website: https://linuxgsm.com
# DO NOT EDIT THIS FILE
# LinuxGSM configuration is no longer edited here
# To update your LinuxGSM config go to:
# lgsm/config-lgsm
# https://docs.linuxgsm.com/configuration/linuxgsm-config
# Debugging
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
travistest="1"
version="180409"
version="v19.6.0"
shortname="jc2"
gameservername="jc2server"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
@ -23,9 +36,13 @@ serverfiles="${rootdir}/serverfiles"
functionsdir="${lgsmdir}/functions"
libdir="${lgsmdir}/lib"
tmpdir="${lgsmdir}/tmp"
datadir="${lgsmdir}/data"
serverlist="${datadir}/serverlist.csv"
serverlistmenu="${datadir}/serverlistmenu.csv"
configdir="${lgsmdir}/config-lgsm"
configdirserver="${configdir}/${gameservername}"
configdirdefault="${lgsmdir}/config-default"
userinput="${1}"
# Allows for testing not on Travis CI
if [ ! -v TRAVIS ]; then
@ -40,16 +57,16 @@ githubuser="GameServerManagers"
githubrepo="LinuxGSM"
githubbranch="${TRAVIS_BRANCH}"
# Core Function that is required first
# Core function that is required first.
core_functions.sh(){
functionfile="${FUNCNAME}"
fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
}
# Bootstrap
# Fetches the core functions required before passed off to core_dl.sh
# Fetches the core functions required before passed off to core_dl.sh.
# Fetches core functions
# Fetches core functions.
fn_bootstrap_fetch_file(){
remote_fileurl="${1}"
local_filedir="${2}"
@ -58,42 +75,42 @@ fn_bootstrap_fetch_file(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# download file if missing or download forced
# Download file if missing or download forced.
if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
if [ ! -d "${local_filedir}" ]; then
mkdir -p "${local_filedir}"
fi
# Defines curl path
# Defines curl path.
curlpath=$(command -v curl 2>/dev/null)
# If curl exists download file
# If curl exists download file.
if [ "$(basename "${curlpath}")" == "curl" ]; then
# trap to remove part downloaded files
# Trap to remove part downloaded files.
echo -en " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then
echo -e "${remote_fileurl}" | tee -a "${lgsmlog}"
echo "${curlcmd}" | tee -a "${lgsmlog}"
fi
exit 1
else
echo -e "\e[0;32mOK\e[0m"
echo -e "OK"
fi
else
echo "[ FAIL ] Curl is not installed"
exit 1
fi
# make file chmodx if chmodx is set
# Make file chmodx if chmodx is set.
if [ "${chmodx}" == "chmodx" ]; then
chmod +x "${local_filedir}/${local_filename}"
fi
fi
if [ -f "${local_filedir}/${local_filename}" ]; then
# run file if run is set
# Run file if run is set.
if [ "${run}" == "run" ]; then
source "${local_filedir}/${local_filename}"
fi
@ -112,11 +129,11 @@ fn_bootstrap_fetch_file_github(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# Passes vars to the file download function
# Passes vars to the file download function.
fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
}
# Installer menu
# Installer menu.
fn_print_center() {
columns="$(tput cols)"
@ -129,7 +146,7 @@ fn_print_horizontal(){
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
}
# Bash Menu
# Bash menu.
fn_install_menu_bash() {
local resultvar=$1
title=$2
@ -153,7 +170,7 @@ fn_install_menu_bash() {
done
}
# Whiptail/Dialog Menu
# Whiptail/Dialog menu.
fn_install_menu_whiptail() {
local menucmd=$1
local resultvar=$2
@ -168,7 +185,7 @@ fn_install_menu_whiptail() {
while read -r line; do
key=$(echo "${line}" | awk -F "," '{print $3}')
val=$(echo "${line}" | awk -F "," '{print $2}')
menu_options+=( ${val//\"} "${key//\"}" )
menu_options+=( "${val//\"}" "${key//\"}" )
done < "${options}"
OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
if [ $? == 0 ]; then
@ -178,14 +195,14 @@ fn_install_menu_whiptail() {
fi
}
# Menu selector
# Menu selector.
fn_install_menu() {
local resultvar=$1
local selection=""
title=$2
caption=$3
options=$4
# Get menu command
# Get menu command.
for menucmd in whiptail dialog bash; do
if [ -x "$(command -v "${menucmd}")" ]; then
menucmd=$(command -v "${menucmd}")
@ -201,7 +218,7 @@ fn_install_menu() {
eval "$resultvar=\"${selection}\""
}
# Gets server info from serverlist.csv and puts in to array
# Gets server info from serverlist.csv and puts in to array.
fn_server_info(){
IFS=","
server_info_array=($(grep -aw "${userinput}" "${serverlist}"))
@ -219,7 +236,7 @@ fn_install_getopt(){
echo -e ""
echo -e "Commands"
echo -e "install\t\t| Select server to install."
echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install."
echo -e "servername\t| Enter name of game server to install. e.g $0 csgoserver."
echo -e "list\t\t| List all servers available for install."
exit
}
@ -248,9 +265,14 @@ fn_install_file(){
exit
}
# Prevent from running this script as root.
# Prevent LinuxGSM from running as root. Except if doing a dependency install.
if [ "$(whoami)" == "root" ]; then
if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then
if [ "${shortname}" == "core" ]; then
echo "[ FAIL ] Do NOT run this script as root!"
exit 1
fi
elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
echo "[ FAIL ] Do NOT run this script as root!"
exit 1
else
@ -259,26 +281,23 @@ if [ "$(whoami)" == "root" ]; then
fi
fi
# LinuxGSM installer mode
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
# LinuxGSM installer mode.
if [ "${shortname}" == "core" ]; then
userinput=$1
datadir="${tmpdir}/data"
serverlist="${datadir}/serverlist.csv"
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
if [ "${userinput}" == "list" ]; then
if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then
{
awk -F "," '{print $2 "\t" $3}' "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}'
} | column -s $'\t' -t | more
exit
elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then
fn_install_menu result "LinuxGSM" "Select game to install" "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}"
fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}"
userinput="${result}"
fn_server_info
if [ "${result}" == "${gameservername}" ]; then
@ -301,65 +320,68 @@ if [ "${shortname}" == "core" ]; then
fn_install_getopt
fi
# LinuxGSM Server Mode
# LinuxGSM server mode.
else
core_functions.sh
# Load LinuxGSM configs
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
exit 1
else
echo -e "\e[0;32mOK\e[0m"
if [ "${shortname}" != "core-dep" ]; then
# Load LinuxGSM configs.
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
else
function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo -e "FAIL"
exit 1
else
echo -e "\e[0;32mOK\e[0m"
echo -e "OK"
fi
else
function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "FAIL"
exit 1
else
echo -e "OK"
fi
fi
fi
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
else
source "${configdirserver}/${servicename}.cfg"
fi
# Load the linuxgsm.sh in to tmpdir. If missing download it
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it.
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it.
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
else
source "${configdirserver}/${servicename}.cfg"
fi
# Prevents running of core_exit.sh for Travis.
if [ -z "${travistest}" ]; then
# Load the linuxgsm.sh in to tmpdir. If missing download it.
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
fi
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
fn_ansi_loader
# Prevents running of core_exit.sh for Travis-CI.
if [ "${travistest}" != "1" ]; then
getopt=$1
core_getopt.sh
fi
@ -914,7 +936,6 @@ echo "IP: ${travisip}"
echo ""
echo "5.0 - Monitor Tests"
echo "=================================================================="
info_config.sh
echo ""
echo "Server IP - Port: ${ip}:${port}"
echo "Server IP - Query Port: ${ip}:${queryport}"

View File

@ -3,12 +3,25 @@
# Author: Daniel Gibbs
# License: MIT License, Copyright (c) 2019 Daniel Gibbs
# Purpose: Travis CI Tests: Minecraft | Linux Game Server Management Script
# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
# Documentation: https://docs.linuxgsm.com/
# Contributors: https://linuxgsm.com/contrib
# Documentation: https://docs.linuxgsm.com
# Website: https://linuxgsm.com
# DO NOT EDIT THIS FILE
# LinuxGSM configuration is no longer edited here
# To update your LinuxGSM config go to:
# lgsm/config-lgsm
# https://docs.linuxgsm.com/configuration/linuxgsm-config
# Debugging
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
travistest="1"
version="190401"
version="v19.6.0"
shortname="mc"
gameservername="mcserver"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
@ -23,9 +36,13 @@ serverfiles="${rootdir}/serverfiles"
functionsdir="${lgsmdir}/functions"
libdir="${lgsmdir}/lib"
tmpdir="${lgsmdir}/tmp"
datadir="${lgsmdir}/data"
serverlist="${datadir}/serverlist.csv"
serverlistmenu="${datadir}/serverlistmenu.csv"
configdir="${lgsmdir}/config-lgsm"
configdirserver="${configdir}/${gameservername}"
configdirdefault="${lgsmdir}/config-default"
userinput="${1}"
# Allows for testing not on Travis CI
if [ ! -v TRAVIS ]; then
@ -40,16 +57,16 @@ githubuser="GameServerManagers"
githubrepo="LinuxGSM"
githubbranch="${TRAVIS_BRANCH}"
# Core Function that is required first
# Core function that is required first.
core_functions.sh(){
functionfile="${FUNCNAME}"
fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
}
# Bootstrap
# Fetches the core functions required before passed off to core_dl.sh
# Fetches the core functions required before passed off to core_dl.sh.
# Fetches core functions
# Fetches core functions.
fn_bootstrap_fetch_file(){
remote_fileurl="${1}"
local_filedir="${2}"
@ -58,42 +75,42 @@ fn_bootstrap_fetch_file(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# download file if missing or download forced
# Download file if missing or download forced.
if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
if [ ! -d "${local_filedir}" ]; then
mkdir -p "${local_filedir}"
fi
# Defines curl path
# Defines curl path.
curlpath=$(command -v curl 2>/dev/null)
# If curl exists download file
# If curl exists download file.
if [ "$(basename "${curlpath}")" == "curl" ]; then
# trap to remove part downloaded files
# Trap to remove part downloaded files.
echo -en " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then
echo -e "${remote_fileurl}" | tee -a "${lgsmlog}"
echo "${curlcmd}" | tee -a "${lgsmlog}"
fi
exit 1
else
echo -e "\e[0;32mOK\e[0m"
echo -e "OK"
fi
else
echo "[ FAIL ] Curl is not installed"
exit 1
fi
# make file chmodx if chmodx is set
# Make file chmodx if chmodx is set.
if [ "${chmodx}" == "chmodx" ]; then
chmod +x "${local_filedir}/${local_filename}"
fi
fi
if [ -f "${local_filedir}/${local_filename}" ]; then
# run file if run is set
# Run file if run is set.
if [ "${run}" == "run" ]; then
source "${local_filedir}/${local_filename}"
fi
@ -112,11 +129,11 @@ fn_bootstrap_fetch_file_github(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# Passes vars to the file download function
# Passes vars to the file download function.
fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
}
# Installer menu
# Installer menu.
fn_print_center() {
columns="$(tput cols)"
@ -129,7 +146,7 @@ fn_print_horizontal(){
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
}
# Bash Menu
# Bash menu.
fn_install_menu_bash() {
local resultvar=$1
title=$2
@ -153,7 +170,7 @@ fn_install_menu_bash() {
done
}
# Whiptail/Dialog Menu
# Whiptail/Dialog menu.
fn_install_menu_whiptail() {
local menucmd=$1
local resultvar=$2
@ -168,7 +185,7 @@ fn_install_menu_whiptail() {
while read -r line; do
key=$(echo "${line}" | awk -F "," '{print $3}')
val=$(echo "${line}" | awk -F "," '{print $2}')
menu_options+=( ${val//\"} "${key//\"}" )
menu_options+=( "${val//\"}" "${key//\"}" )
done < "${options}"
OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
if [ $? == 0 ]; then
@ -178,14 +195,14 @@ fn_install_menu_whiptail() {
fi
}
# Menu selector
# Menu selector.
fn_install_menu() {
local resultvar=$1
local selection=""
title=$2
caption=$3
options=$4
# Get menu command
# Get menu command.
for menucmd in whiptail dialog bash; do
if [ -x "$(command -v "${menucmd}")" ]; then
menucmd=$(command -v "${menucmd}")
@ -201,7 +218,7 @@ fn_install_menu() {
eval "$resultvar=\"${selection}\""
}
# Gets server info from serverlist.csv and puts in to array
# Gets server info from serverlist.csv and puts in to array.
fn_server_info(){
IFS=","
server_info_array=($(grep -aw "${userinput}" "${serverlist}"))
@ -219,7 +236,7 @@ fn_install_getopt(){
echo -e ""
echo -e "Commands"
echo -e "install\t\t| Select server to install."
echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install."
echo -e "servername\t| Enter name of game server to install. e.g $0 csgoserver."
echo -e "list\t\t| List all servers available for install."
exit
}
@ -248,9 +265,14 @@ fn_install_file(){
exit
}
# Prevent from running this script as root.
# Prevent LinuxGSM from running as root. Except if doing a dependency install.
if [ "$(whoami)" == "root" ]; then
if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then
if [ "${shortname}" == "core" ]; then
echo "[ FAIL ] Do NOT run this script as root!"
exit 1
fi
elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
echo "[ FAIL ] Do NOT run this script as root!"
exit 1
else
@ -259,26 +281,23 @@ if [ "$(whoami)" == "root" ]; then
fi
fi
# LinuxGSM installer mode
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
# LinuxGSM installer mode.
if [ "${shortname}" == "core" ]; then
userinput=$1
datadir="${tmpdir}/data"
serverlist="${datadir}/serverlist.csv"
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
if [ "${userinput}" == "list" ]; then
if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then
{
awk -F "," '{print $2 "\t" $3}' "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}'
} | column -s $'\t' -t | more
exit
elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then
fn_install_menu result "LinuxGSM" "Select game to install" "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}"
fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}"
userinput="${result}"
fn_server_info
if [ "${result}" == "${gameservername}" ]; then
@ -301,65 +320,68 @@ if [ "${shortname}" == "core" ]; then
fn_install_getopt
fi
# LinuxGSM Server Mode
# LinuxGSM server mode.
else
core_functions.sh
# Load LinuxGSM configs
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
exit 1
else
echo -e "\e[0;32mOK\e[0m"
if [ "${shortname}" != "core-dep" ]; then
# Load LinuxGSM configs.
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
else
function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo -e "FAIL"
exit 1
else
echo -e "\e[0;32mOK\e[0m"
echo -e "OK"
fi
else
function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "FAIL"
exit 1
else
echo -e "OK"
fi
fi
fi
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
else
source "${configdirserver}/${servicename}.cfg"
fi
# Load the linuxgsm.sh in to tmpdir. If missing download it
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it.
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it.
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
else
source "${configdirserver}/${servicename}.cfg"
fi
# Prevents running of core_exit.sh for Travis.
if [ -z "${travistest}" ]; then
# Load the linuxgsm.sh in to tmpdir. If missing download it.
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
fi
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
fn_ansi_loader
# Prevents running of core_exit.sh for Travis-CI.
if [ "${travistest}" != "1" ]; then
getopt=$1
core_getopt.sh
fi
@ -783,7 +805,6 @@ echo "IP: ${travisip}"
echo ""
echo "5.0 - Monitor Tests"
echo "=================================================================="
info_config.sh
echo ""
echo "Server IP - Port: ${ip}:${port}"
echo "Server IP - Query Port: ${ip}:${queryport}"

View File

@ -3,12 +3,25 @@
# Author: Daniel Gibbs
# License: MIT License, Copyright (c) 2019 Daniel Gibbs
# Purpose: Travis CI Tests: Teamspeak 3 | Linux Game Server Management Script
# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
# Documentation: https://docs.linuxgsm.com/
# Contributors: https://linuxgsm.com/contrib
# Documentation: https://docs.linuxgsm.com
# Website: https://linuxgsm.com
# DO NOT EDIT THIS FILE
# LinuxGSM configuration is no longer edited here
# To update your LinuxGSM config go to:
# lgsm/config-lgsm
# https://docs.linuxgsm.com/configuration/linuxgsm-config
# Debugging
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
travistest="1"
version="180409"
version="v19.6.0"
shortname="ts3"
gameservername="ts3server"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
@ -23,9 +36,13 @@ serverfiles="${rootdir}/serverfiles"
functionsdir="${lgsmdir}/functions"
libdir="${lgsmdir}/lib"
tmpdir="${lgsmdir}/tmp"
datadir="${lgsmdir}/data"
serverlist="${datadir}/serverlist.csv"
serverlistmenu="${datadir}/serverlistmenu.csv"
configdir="${lgsmdir}/config-lgsm"
configdirserver="${configdir}/${gameservername}"
configdirdefault="${lgsmdir}/config-default"
userinput="${1}"
# Allows for testing not on Travis CI
if [ ! -v TRAVIS ]; then
@ -40,16 +57,16 @@ githubuser="GameServerManagers"
githubrepo="LinuxGSM"
githubbranch="${TRAVIS_BRANCH}"
# Core Function that is required first
# Core function that is required first.
core_functions.sh(){
functionfile="${FUNCNAME}"
fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
}
# Bootstrap
# Fetches the core functions required before passed off to core_dl.sh
# Fetches the core functions required before passed off to core_dl.sh.
# Fetches core functions
# Fetches core functions.
fn_bootstrap_fetch_file(){
remote_fileurl="${1}"
local_filedir="${2}"
@ -58,42 +75,42 @@ fn_bootstrap_fetch_file(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# download file if missing or download forced
# Download file if missing or download forced.
if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
if [ ! -d "${local_filedir}" ]; then
mkdir -p "${local_filedir}"
fi
# Defines curl path
# Defines curl path.
curlpath=$(command -v curl 2>/dev/null)
# If curl exists download file
# If curl exists download file.
if [ "$(basename "${curlpath}")" == "curl" ]; then
# trap to remove part downloaded files
# Trap to remove part downloaded files.
echo -en " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then
echo -e "${remote_fileurl}" | tee -a "${lgsmlog}"
echo "${curlcmd}" | tee -a "${lgsmlog}"
fi
exit 1
else
echo -e "\e[0;32mOK\e[0m"
echo -e "OK"
fi
else
echo "[ FAIL ] Curl is not installed"
exit 1
fi
# make file chmodx if chmodx is set
# Make file chmodx if chmodx is set.
if [ "${chmodx}" == "chmodx" ]; then
chmod +x "${local_filedir}/${local_filename}"
fi
fi
if [ -f "${local_filedir}/${local_filename}" ]; then
# run file if run is set
# Run file if run is set.
if [ "${run}" == "run" ]; then
source "${local_filedir}/${local_filename}"
fi
@ -112,11 +129,11 @@ fn_bootstrap_fetch_file_github(){
run="${5:-0}"
forcedl="${6:-0}"
md5="${7:-0}"
# Passes vars to the file download function
# Passes vars to the file download function.
fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
}
# Installer menu
# Installer menu.
fn_print_center() {
columns="$(tput cols)"
@ -129,7 +146,7 @@ fn_print_horizontal(){
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
}
# Bash Menu
# Bash menu.
fn_install_menu_bash() {
local resultvar=$1
title=$2
@ -153,7 +170,7 @@ fn_install_menu_bash() {
done
}
# Whiptail/Dialog Menu
# Whiptail/Dialog menu.
fn_install_menu_whiptail() {
local menucmd=$1
local resultvar=$2
@ -168,7 +185,7 @@ fn_install_menu_whiptail() {
while read -r line; do
key=$(echo "${line}" | awk -F "," '{print $3}')
val=$(echo "${line}" | awk -F "," '{print $2}')
menu_options+=( ${val//\"} "${key//\"}" )
menu_options+=( "${val//\"}" "${key//\"}" )
done < "${options}"
OPTION=$(${menucmd} --title "${title}" --menu "${caption}" "${height}" "${width}" "${menuheight}" "${menu_options[@]}" 3>&1 1>&2 2>&3)
if [ $? == 0 ]; then
@ -178,14 +195,14 @@ fn_install_menu_whiptail() {
fi
}
# Menu selector
# Menu selector.
fn_install_menu() {
local resultvar=$1
local selection=""
title=$2
caption=$3
options=$4
# Get menu command
# Get menu command.
for menucmd in whiptail dialog bash; do
if [ -x "$(command -v "${menucmd}")" ]; then
menucmd=$(command -v "${menucmd}")
@ -201,7 +218,7 @@ fn_install_menu() {
eval "$resultvar=\"${selection}\""
}
# Gets server info from serverlist.csv and puts in to array
# Gets server info from serverlist.csv and puts in to array.
fn_server_info(){
IFS=","
server_info_array=($(grep -aw "${userinput}" "${serverlist}"))
@ -219,7 +236,7 @@ fn_install_getopt(){
echo -e ""
echo -e "Commands"
echo -e "install\t\t| Select server to install."
echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install."
echo -e "servername\t| Enter name of game server to install. e.g $0 csgoserver."
echo -e "list\t\t| List all servers available for install."
exit
}
@ -248,9 +265,14 @@ fn_install_file(){
exit
}
# Prevent from running this script as root.
# Prevent LinuxGSM from running as root. Except if doing a dependency install.
if [ "$(whoami)" == "root" ]; then
if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
if [ "${userinput}" == "install" ]||[ "${userinput}" == "auto-install" ]||[ "${userinput}" == "i" ]||[ "${userinput}" == "ai" ]; then
if [ "${shortname}" == "core" ]; then
echo "[ FAIL ] Do NOT run this script as root!"
exit 1
fi
elif [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
echo "[ FAIL ] Do NOT run this script as root!"
exit 1
else
@ -259,26 +281,23 @@ if [ "$(whoami)" == "root" ]; then
fi
fi
# LinuxGSM installer mode
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
# LinuxGSM installer mode.
if [ "${shortname}" == "core" ]; then
userinput=$1
datadir="${tmpdir}/data"
serverlist="${datadir}/serverlist.csv"
# Download the latest serverlist. This is the complete list of all supported servers.
fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
if [ ! -f "${serverlist}" ]; then
echo "[ FAIL ] serverlist.csv could not be loaded."
exit 1
fi
if [ "${userinput}" == "list" ]; then
if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then
{
awk -F "," '{print $2 "\t" $3}' "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}'
} | column -s $'\t' -t | more
exit
elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then
fn_install_menu result "LinuxGSM" "Select game to install" "${serverlist}"
tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}"
fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}"
userinput="${result}"
fn_server_info
if [ "${result}" == "${gameservername}" ]; then
@ -301,65 +320,68 @@ if [ "${shortname}" == "core" ]; then
fn_install_getopt
fi
# LinuxGSM Server Mode
# LinuxGSM server mode.
else
core_functions.sh
# Load LinuxGSM configs
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
exit 1
else
echo -e "\e[0;32mOK\e[0m"
if [ "${shortname}" != "core-dep" ]; then
# Load LinuxGSM configs.
# These are required to get all the default variables for the specific server.
# Load the default config. If missing download it. If changed reload it.
if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
fi
else
function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
if [ ! -f "${configdirserver}/_default.cfg" ]; then
mkdir -p "${configdirserver}"
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo -e "FAIL"
exit 1
else
echo -e "\e[0;32mOK\e[0m"
echo -e "OK"
fi
else
function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
if [ "${function_file_diff}" != "" ]; then
fn_print_warn_nl "_default.cfg has been altered. reloading config."
echo -en " copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
echo -e "FAIL"
exit 1
else
echo -e "OK"
fi
fi
fi
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
else
source "${configdirserver}/${servicename}.cfg"
fi
# Load the linuxgsm.sh in to tmpdir. If missing download it
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
source "${configdirserver}/_default.cfg"
# Load the common.cfg config. If missing download it.
if [ ! -f "${configdirserver}/common.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/common.cfg"
else
source "${configdirserver}/common.cfg"
fi
# Load the instance.cfg config. If missing download it.
if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
source "${configdirserver}/${servicename}.cfg"
else
source "${configdirserver}/${servicename}.cfg"
fi
# Prevents running of core_exit.sh for Travis.
if [ -z "${travistest}" ]; then
# Load the linuxgsm.sh in to tmpdir. If missing download it.
if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
fi
fi
# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
fn_ansi_loader
# Prevents running of core_exit.sh for Travis-CI.
if [ "${travistest}" != "1" ]; then
getopt=$1
core_getopt.sh
fi
@ -760,7 +782,6 @@ grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g
echo ""
echo "5.0 - Monitor Tests"
echo "=================================================================="
echo ""
echo "Server IP - Port: ${ip}:${port}"
echo "Server IP - Query Port: ${ip}:${queryport}"