renamed filesdir to serverfiles

makign it easier to understand by changing the var to serverfiles (the actual name of the directory
This commit is contained in:
Daniel Gibbs 2017-04-16 19:24:27 +01:00
parent 0442559cc9
commit 6fbd530633
36 changed files with 246 additions and 252 deletions

View File

@ -47,7 +47,7 @@ If you want to donate to the project you can via PayPal. I have had a may kind p
<li><a href="https://github.com/GameServerManagers/LinuxGSM/wiki">Wiki</a></li> <li><a href="https://github.com/GameServerManagers/LinuxGSM/wiki">Wiki</a></li>
<li><a href="https://github.com/GameServerManagers/LinuxGSM">GitHub Code</a></li> <li><a href="https://github.com/GameServerManagers/LinuxGSM">GitHub Code</a></li>
<li><a href="https://github.com/GameServerManagers/LinuxGSM/issues">GitHub Issues</a></li> <li><a href="https://github.com/GameServerManagers/LinuxGSM/issues">GitHub Issues</a></li>
<li><a href="https://waffle.io/GameServerManagers/LinuxGSM">Waffle (Github Dashboard)</a></li> <li><a href="https://waffle.io/GameServerManagers/LinuxGSM">Waffle (GitHub Dashboard)</a></li>
<li><a href="http://alternativeto.net/software/linux-game-server-managers/">alternativeTo.net</a></li> <li><a href="http://alternativeto.net/software/linux-game-server-managers/">alternativeTo.net</a></li>
</ul> </ul>
<h2>Social</h2> <h2>Social</h2>

View File

@ -65,7 +65,7 @@ engine="unreal4"
# Edit with care # Edit with care
## Server Specific Directories ## Server Specific Directories
systemdir="${filesdir}/ShooterGame" systemdir="${serverfiles}/ShooterGame"
executabledir="${systemdir}/Binaries/Linux" executabledir="${systemdir}/Binaries/Linux"
executable="./ShooterGameServer" executable="./ShooterGameServer"
servercfgdir="${systemdir}/Saved/Config/LinuxServer" servercfgdir="${systemdir}/Saved/Config/LinuxServer"

View File

@ -73,8 +73,8 @@ engine="realvirtuality"
# Edit with care # Edit with care
## Server Specific Directories ## Server Specific Directories
systemdir="${filesdir}" systemdir="${serverfiles}"
executabledir="${filesdir}" executabledir="${serverfiles}"
executable="./arma3server" executable="./arma3server"
servercfg="${servicename}.server.cfg" servercfg="${servicename}.server.cfg"
networkcfg="${servicename}.network.cfg" networkcfg="${servicename}.network.cfg"

View File

@ -89,8 +89,8 @@ engine="source"
# Edit with care # Edit with care
## Server Specific Directories ## Server Specific Directories
systemdir="${filesdir}/csgo" systemdir="${serverfiles}/csgo"
executabledir="${filesdir}" executabledir="${serverfiles}"
executable="./srcds_run" executable="./srcds_run"
servercfg="${servicename}.cfg" servercfg="${servicename}.cfg"
servercfgdefault="server.cfg" servercfgdefault="server.cfg"

View File

@ -65,12 +65,12 @@ engine="unity3d"
# Edit with care # Edit with care
## Server Specific Directories ## Server Specific Directories
systemdir="${filesdir}" systemdir="${serverfiles}"
executabledir="${filesdir}" executabledir="${serverfiles}"
executable="./7DaysToDieServer.x86" executable="./7DaysToDieServer.x86"
servercfg="${servicename}.xml" servercfg="${servicename}.xml"
servercfgdefault="serverconfig.xml" servercfgdefault="serverconfig.xml"
servercfgdir="${filesdir}" servercfgdir="${serverfiles}"
servercfgfullpath="${servercfgdir}/${servercfg}" servercfgfullpath="${servercfgdir}/${servercfg}"
## Backup Directory ## Backup Directory

View File

@ -18,8 +18,8 @@ fn_check_ownership(){
funcownissue=1 funcownissue=1
fi fi
fi fi
if [ -d "${filesdir}" ]; then if [ -d "${serverfiles}" ]; then
if [ $(find "${filesdir}" -not -user $(whoami)|wc -l) -ne "0" ]; then if [ $(find "${serverfiles}" -not -user $(whoami)|wc -l) -ne "0" ]; then
filesownissue=1 filesownissue=1
fi fi
fi fi
@ -37,7 +37,7 @@ fn_check_ownership(){
find "${functionsdir}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n" find "${functionsdir}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n"
fi fi
if [ "${filesownissue}" == "1" ]; then if [ "${filesownissue}" == "1" ]; then
find "${filesdir}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n" find "${serverfiles}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n"
fi fi
} | column -s $'\t' -t | tee -a "${scriptlog}" } | column -s $'\t' -t | tee -a "${scriptlog}"

View File

@ -15,21 +15,21 @@ if [ -z "$(command -v objdump)" ]; then
core_exit.sh core_exit.sh
fi fi
if [ -z "${filesdir}" ]; then if [ -z "${serverfiles}" ]; then
dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
fi fi
if [ -d "${filesdir}" ]; then if [ -d "${serverfiles}" ]; then
echo "Checking directory: " echo "Checking directory: "
echo "${filesdir}" echo "${serverfiles}"
elif [ -f "${filesdir}" ]; then elif [ -f "${serverfiles}" ]; then
echo "Checking file: " echo "Checking file: "
echo "${filesdir}" echo "${serverfiles}"
fi fi
echo "" echo ""
files=$(find ${filesdir} | wc -l) files=$(find ${serverfiles} | wc -l)
find ${filesdir} -type f -print0 | find ${serverfiles} -type f -print0 |
while IFS= read -r -d $'\0' line; do while IFS= read -r -d $'\0' line; do
objdump -T $line 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc.tmp" objdump -T $line 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc.tmp"
echo -n "$i / $files" $'\r' echo -n "$i / $files" $'\r'

View File

@ -9,21 +9,21 @@ echo "================================="
echo "Shared Object dependencies Checker" echo "Shared Object dependencies Checker"
echo "=================================" echo "================================="
if [ -z "${filesdir}" ]; then if [ -z "${serverfiles}" ]; then
dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
fi fi
if [ -d "${filesdir}" ]; then if [ -d "${serverfiles}" ]; then
echo "Checking directory: " echo "Checking directory: "
echo "${filesdir}" echo "${serverfiles}"
elif [ -f "${filesdir}" ]; then elif [ -f "${serverfiles}" ]; then
echo "Checking file: " echo "Checking file: "
echo "${filesdir}" echo "${serverfiles}"
fi fi
echo "" echo ""
files=$(find "${filesdir}" | wc -l) files=$(find "${serverfiles}" | wc -l)
find "${filesdir}" -type f -print0 | find "${serverfiles}" -type f -print0 |
while IFS= read -r -d $'\0' line; do while IFS= read -r -d $'\0' line; do
#ldd -v $line 2>/dev/null|grep "=>" >>"${tmpdir}/detect_ldd.tmp" #ldd -v $line 2>/dev/null|grep "=>" >>"${tmpdir}/detect_ldd.tmp"
if [ -n "$(ldd $line 2>/dev/null |grep -v "not a dynamic executable")" ]; then if [ -n "$(ldd $line 2>/dev/null |grep -v "not a dynamic executable")" ]; then

View File

@ -252,7 +252,7 @@ fn_stop_ark(){
if [ -z "${queryport}" ]; then if [ -z "${queryport}" ]; then
fn_print_warn "No queryport found using info_config.sh" fn_print_warn "No queryport found using info_config.sh"
fn_script_log_warn "No queryport found using info_config.sh" fn_script_log_warn "No queryport found using info_config.sh"
userconfigfile="${filesdir}" userconfigfile="${serverfiles}"
userconfigfile+="/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini" userconfigfile+="/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini"
queryport=$(grep ^QueryPort= ${userconfigfile} | cut -d= -f2 | sed "s/[^[:digit:].*].*//g") queryport=$(grep ^QueryPort= ${userconfigfile} | cut -d= -f2 | sed "s/[^[:digit:].*].*//g")
fi fi
@ -291,7 +291,7 @@ fn_stop_ark(){
fn_stop_teamspeak3(){ fn_stop_teamspeak3(){
fn_print_dots "${servername}" fn_print_dots "${servername}"
sleep 0.5 sleep 0.5
"${filesdir}"/ts3server_startscript.sh stop > /dev/null 2>&1 "${serverfiles}"/ts3server_startscript.sh stop > /dev/null 2>&1
check_status.sh check_status.sh
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then
# Remove lockfile # Remove lockfile

View File

@ -27,9 +27,9 @@ fn_validation(){
fi fi
if [ "${engine}" == "goldsource" ]; then if [ "${engine}" == "goldsource" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}" ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
else else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}" ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
fi fi
if [ $? != 0 ]; then if [ $? != 0 ]; then
fn_print_fail_nl "Validating files: SteamCMD" fn_print_fail_nl "Validating files: SteamCMD"

View File

@ -21,10 +21,10 @@ if ! fn_prompt_yn "Start compression?" Y; then
echo Exiting; return echo Exiting; return
fi fi
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
rm -rfv "${filesdir}/Maps/"*.ut2.uz2 rm -rfv "${serverfiles}/Maps/"*.ut2.uz2
cd "${systemdir}" cd "${systemdir}"
for map in "${filesdir}/Maps/"*; do for map in "${serverfiles}/Maps/"*; do
./ucc-bin compress "${map}" --nohomedir ./ucc-bin compress "${map}" --nohomedir
done done
mv -fv "${filesdir}/Maps/"*.ut2.uz2 "${compressedmapsdir}" mv -fv "${serverfiles}/Maps/"*.ut2.uz2 "${compressedmapsdir}"
core_exit.sh core_exit.sh

View File

@ -21,10 +21,10 @@ if ! fn_prompt_yn "Start compression?" Y; then
echo Exiting; return echo Exiting; return
fi fi
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
rm -rfv "${filesdir}/Maps/"*.unr.uz rm -rfv "${serverfiles}/Maps/"*.unr.uz
cd "${systemdir}" cd "${systemdir}"
for map in "${filesdir}/Maps/"*; do for map in "${serverfiles}/Maps/"*; do
./ucc-bin compress "${map}" --nohomedir ./ucc-bin compress "${map}" --nohomedir
done done
mv -fv "${filesdir}/Maps/"*.unr.uz "${compressedmapsdir}" mv -fv "${serverfiles}/Maps/"*.unr.uz "${compressedmapsdir}"
core_exit.sh core_exit.sh

View File

@ -5,17 +5,17 @@
# Website: https://gameservermanagers.com # Website: https://gameservermanagers.com
# Description: Deals with all downloads for LinuxGSM. # Description: Deals with all downloads for LinuxGSM.
# fileurl: The URL of the file: http://example.com/dl/File.tar.bz2 # remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2
# filedir: location the file is to be saved: /home/server/lgsm/tmp # local_filedir: location the file is to be saved: /home/server/lgsm/tmp
# filename: name of file (this can be different from the url name): file.tar.bz2 # local_filename: name of file (this can be different from the url name): file.tar.bz2
# executecmd: Optional, set to "executecmd" to make file executable using chmod +x # chmodx: Optional, set to "chmodx" to make file executable using chmod +x
# run: Optional, set to run to execute the file # run: Optional, set run to execute the file after download
# force: Optional, force re-download of file even if exists # forcedl: Optional, force re-download of file even if exists
# md5: Optional, Checks file against an md5 sum # md5: Optional, set an md5 sum and will compare it against the file.
# #
# Downloads can be defined in code like so: # Downloads can be defined in code like so:
# fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" # fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
# fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "executecmd" "run" "force" "10cd7353aa9d758a075c600a6dd193fd" # fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd"
local commandname="DOWNLOAD" local commandname="DOWNLOAD"
local commandaction="Download" local commandaction="Download"
@ -24,50 +24,50 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_dl_md5(){ fn_dl_md5(){
# Runs MD5 Check if available # Runs MD5 Check if available
if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then
echo -ne "verifying ${filename} with MD5..." echo -ne "verifying ${local_filename} with MD5..."
sleep 1 sleep 1
local md5sumcmd=$(md5sum "${filedir}/${filename}"|awk '{print $1;}') local md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}')
if [ "${md5sumcmd}" != "${md5}" ]; then if [ "${md5sumcmd}" != "${md5}" ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
echo "${filename} returned MD5 checksum: ${md5sumcmd}" echo "${local_filename} returned MD5 checksum: ${md5sumcmd}"
echo "expected MD5 checksum: ${md5}" echo "expected MD5 checksum: ${md5}"
fn_script_log_fatal "Verifying ${filename} with MD5: FAIL" fn_script_log_fatal "Verifying ${local_filename} with MD5: FAIL"
fn_script_log_info "${filename} returned MD5 checksum: ${md5sumcmd}" fn_script_log_info "${local_filename} returned MD5 checksum: ${md5sumcmd}"
fn_script_log_info "Expected MD5 checksum: ${md5}" fn_script_log_info "Expected MD5 checksum: ${md5}"
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Verifying ${filename} with MD5: OK" fn_script_log_pass "Verifying ${local_filename} with MD5: OK"
fn_script_log_info "${filename} returned MD5 checksum: ${md5sumcmd}" fn_script_log_info "${local_filename} returned MD5 checksum: ${md5sumcmd}"
fn_script_log_info "Expected MD5 checksum: ${md5}" fn_script_log_info "Expected MD5 checksum: ${md5}"
fi fi
fi fi
} }
# Extracts bzip2 or gzip or zip files # Extracts bzip2, gzip or zip files
# Extracts can be defined in code like so: # Extracts can be defined in code like so:
# fn_dl_extract "${filedir}" "${filename}" "${extractdir}" # fn_dl_extract "${local_filedir}" "${local_filename}" "${extractdir}"
# fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles" # fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles"
fn_dl_extract(){ fn_dl_extract(){
filedir="${1}" local_filedir="${1}"
filename="${2}" local_filename="${2}"
extractdir="${3}" extractdir="${3}"
# extracts archives # extracts archives
echo -ne "extracting ${filename}..." echo -ne "extracting ${local_filename}..."
mime=$(file -b --mime-type "${filedir}/${filename}") mime=$(file -b --mime-type "${local_filedir}/${local_filename}")
if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then
tarcmd=$(tar -zxf "${filedir}/${filename}" -C "${extractdir}") extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdir}")
elif [ "${mime}" == "application/x-bzip2" ]; then elif [ "${mime}" == "application/x-bzip2" ]; then
tarcmd=$(tar -jxf "${filedir}/${filename}" -C "${extractdir}") extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}")
elif [ "${mime}" == "application/zip" ]; then elif [ "${mime}" == "application/zip" ]; then
tarcmd=$(unzip -d "${extractdir}" "${filedir}/${filename}") extractcmd=$(unzip -d "${extractdir}" "${local_filedir}/${local_filename}")
fi fi
local exitcode=$? local exitcode=$?
if [ ${exitcode} -ne 0 ]; then if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fatal "Extracting download: FAIL" fn_script_log_fatal "Extracting download: FAIL"
echo "${tarcmd}" | tee -a "${scriptlog}" echo "${extractcmd}" | tee -a "${scriptlog}"
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
@ -78,163 +78,155 @@ fn_dl_extract(){
# Trap to remove file download if canceled before completed # Trap to remove file download if canceled before completed
fn_fetch_trap(){ fn_fetch_trap(){
echo "" echo ""
echo -ne "downloading ${filename}..." echo -ne "downloading ${local_filename}..."
fn_print_canceled_eol_nl fn_print_canceled_eol_nl
fn_script_log_info "Downloading ${filename}...CANCELED" fn_script_log_info "Downloading ${local_filename}...CANCELED"
sleep 1 sleep 1
rm -f "${filedir}/${filename}" | tee -a "${scriptlog}" rm -f "${local_filedir}/${local_filename}" | tee -a "${scriptlog}"
echo -ne "downloading ${filename}..." echo -ne "downloading ${local_filename}..."
fn_print_removed_eol_nl fn_print_removed_eol_nl
fn_script_log_info "Downloading ${filename}...REMOVED" fn_script_log_info "Downloading ${local_filename}...REMOVED"
core_exit.sh core_exit.sh
} }
fn_fetch_file(){ fn_fetch_file(){
fileurl="${1}" remote_fileurl="${1}"
filedir="${2}" local_filedir="${2}"
filename="${3}" local_filename="${3}"
executecmd="${4:-0}" chmodx="${4:-0}"
run="${5:-0}" run="${5:-0}"
force="${6:-0}" forcedl="${6:-0}"
md5="${7:-0}" md5="${7:-0}"
# If the file is missing, then download # If the file is missing, then download
if [ ! -f "${filedir}/${filename}" ]; then if [ ! -f "${local_filedir}/${local_filename}" ]; then
if [ ! -d "${filedir}" ]; then if [ ! -d "${local_filedir}" ]; then
mkdir -p "${filedir}" mkdir -p "${local_filedir}"
fi fi
# Trap will remove part downloaded files if canceled
# Check curl exists and use available path trap fn_fetch_trap INT
curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)" # if larger file shows progress bar
for curlpath in ${curlpaths} if [ "${local_filename##*.}" == "bz2" ]||[ "${local_filename##*.}" == "gz" ]||[ "${local_filename##*.}" == "zip" ]||[ "${local_filename##*.}" == "jar" ]; then
do echo -ne "downloading ${local_filename}..."
if [ -x "${curlpath}" ]; then sleep 1
break curlcmd=$(${curlpath} --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}")
fi echo -ne "downloading ${local_filename}..."
done
# If curl exists download file
if [ "$(basename ${curlpath})" == "curl" ]; then
# trap to remove part downloaded files
trap fn_fetch_trap INT
# if larger file shows progress bar
if [ "${filename##*.}" == "bz2" ]||[ "${filename##*.}" == "gz" ]||[ "${filename##*.}" == "zip" ]||[ "${filename##*.}" == "jar" ]; then
echo -ne "downloading ${filename}..."
sleep 1
curlcmd=$(${curlpath} --progress-bar --fail -L -o "${filedir}/${filename}" "${fileurl}")
echo -ne "downloading ${filename}..."
else
echo -ne " fetching ${filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${filedir}/${filename}" "${fileurl}" 2>&1)
fi
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl
if [ -f "${scriptlog}" ]; then
fn_script_log_fatal "Downloading ${filename}: FAIL"
fi
echo -e "${fileurl}" | tee -a "${scriptlog}"
echo "${curlcmd}" | tee -a "${scriptlog}"
core_exit.sh
else
fn_print_ok_eol_nl
if [ -f "${scriptlog}" ]; then
fn_script_log_pass "Downloading ${filename}: OK"
fi
fi
# remove trap
trap - INT
else else
echo -ne " fetching ${local_filename}...\c"
curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
fi
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
echo "Curl is not installed!"
echo -e ""
if [ -f "${scriptlog}" ]; then if [ -f "${scriptlog}" ]; then
fn_script_log_fatal "Curl is not installed!" fn_script_log_fatal "Downloading ${local_filename}: FAIL"
fi fi
echo -e "${remote_fileurl}" | tee -a "${scriptlog}"
echo "${curlcmd}" | tee -a "${scriptlog}"
core_exit.sh core_exit.sh
else
fn_print_ok_eol_nl
if [ -f "${scriptlog}" ]; then
fn_script_log_pass "Downloading ${local_filename}: OK"
fi
fi fi
# make file executecmd if executecmd is set # Remove trap
if [ "${executecmd}" == "executecmd" ]; then trap - INT
chmod +x "${filedir}/${filename}" # Make file executable if chmodx is set
if [ "${chmodx}" == "chmodx" ]; then
chmod +x "${local_filedir}/${local_filename}"
fi fi
fi fi
if [ -f "${filedir}/${filename}" ]; then if [ -f "${local_filedir}/${local_filename}" ]; then
fn_dl_md5 fn_dl_md5
# run file if run is set # Execute file if run is set
if [ "${run}" == "run" ]; then if [ "${run}" == "run" ]; then
source "${filedir}/${filename}" source "${local_filedir}/${local_filename}"
fi fi
fi fi
} }
# GitHub file download functions
# Used to simplify downloading specific files from GitHub
# fileurl: The directory the file is located in teh GitHub repo # github_file_url_dir: the directory of the file in the GitHub: lgsm/functions
# filedir: name of file # github_file_url_name: the filename of the file to download from GitHub: core_messages.sh
# filename: location file to be saved # githuburl: the full GitHub url
# executecmd: set to "executecmd" to make file executecmd
# run: Optional, set to run to execute the file
# force: force download of file even if exists
# md5: Checks fail against an md5 sum
fn_fetch_config(){ # remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2
github_file_url_dir="${1}" # github dir containing the file # local_filedir: location the file is to be saved: /home/server/lgsm/tmp
github_file_url_name="${2}" # name of the github file # local_filename: name of file (this can be different from the url name): file.tar.bz2
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" # chmodx: Optional, set to "chmodx" to make file executable using chmod +x
fileurl="${githuburl}" # run: Optional, set run to execute the file after download
filedir="${3}" # forcedl: Optional, force re-download of file even if exists
filename="${4}" # md5: Optional, set an md5 sum and will compare it against the file.
executecmd="noexecutecmd"
run="norun"
force="noforce"
md5="nomd5"
fn_boostrap_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
}
# Fetches files from the github repo # Fetches any files from the GitHub repo
fn_fetch_file_github(){ fn_fetch_file_github(){
github_file_url_dir="${1}" github_file_url_dir="${1}"
github_file_url_name="${2}" github_file_url_name="${2}"
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fileurl="${githuburl}"
filedir="${3}" remote_fileurl="${githuburl}"
filename="${github_file_url_name}" local_filedir="${3}"
executecmd="${4:-0}" local_filename="${github_file_url_name}"
chmodx="${4:-0}"
run="${5:-0}" run="${5:-0}"
force="${6:-0}" forcedl="${6:-0}"
md5="${7:-0}" md5="${7:-0}"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" # Passes vars to the file download function
fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
} }
fn_fetch_config(){
github_file_url_dir="${1}"
github_file_url_name="${2}"
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="${githuburl}"
local_filedir="${3}"
local_filename="${4}"
chmodx="noexecutecmd"
run="norun"
forcedl="noforce"
md5="nomd5"
# Passes vars to the file download function
fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
}
# Fetches functions # Fetches functions
fn_fetch_function(){ fn_fetch_function(){
github_file_url_dir="lgsm/functions" # github dir containing the file github_file_url_dir="lgsm/functions"
github_file_url_name="${functionfile}" # name of the github file github_file_url_name="${functionfile}"
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fileurl="${githuburl}"
filedir="${functionsdir}" remote_fileurl="${githuburl}"
filename="${github_file_url_name}" local_filedir="${functionsdir}"
executecmd="executecmd" local_filename="${github_file_url_name}"
chmodx="chmodx"
run="run" run="run"
force="noforce" forcedl="noforce"
md5="nomd5" md5="nomd5"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" # Passes vars to the file download function
fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
} }
fn_update_function(){ fn_update_function(){
exitbypass=1 exitbypass=1
github_file_url_dir="lgsm/functions" # github dir containing the file github_file_url_dir="lgsm/functions"
github_file_url_name="${functionfile}" # name of the github file github_file_url_name="${functionfile}"
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fileurl="${githuburl}"
filedir="${functionsdir}" remote_fileurl="${githuburl}"
filename="${github_file_url_name}" local_filedir="${functionsdir}"
executecmd="executecmd" local_filename="${github_file_url_name}"
chmodx="chmodx"
run="norun" run="norun"
force="noforce" forcedl="noforce"
md5="nomd5" md5="nomd5"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
} }
@ -245,4 +237,9 @@ do
if [ -x "${curlpath}" ]; then if [ -x "${curlpath}" ]; then
break break
fi fi
done done
if [ "$(basename ${curlpath})" != "curl" ]; then
echo "[ FAIL ] Curl is not installed"
exit 1
fi

View File

@ -9,10 +9,10 @@ local commandaction="Fix"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
# Fixes: server not always creating steam_appid.txt file. # Fixes: server not always creating steam_appid.txt file.
if [ ! -f "${filesdir}/steam_appid.txt" ]; then if [ ! -f "${serverfiles}/steam_appid.txt" ]; then
fixname="730 steam_appid.txt" fixname="730 steam_appid.txt"
fn_fix_msg_start fn_fix_msg_start
echo -n "730" >> "${filesdir}/steam_appid.txt" echo -n "730" >> "${serverfiles}/steam_appid.txt"
fn_fix_msg_end fn_fix_msg_end
fi fi

View File

@ -10,9 +10,9 @@ 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. # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.
if [ -f "/etc/redhat-release" ] && [ ! -f "${filesdir}/bin/lib32/libcurl-gnutls.so.4" ]; then if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/lib32/libcurl-gnutls.so.4" ]; then
fixname="libcurl-gnutls.so.4 missing" fixname="libcurl-gnutls.so.4 missing"
fn_fix_msg_start fn_fix_msg_start
ln -s "/usr/lib/libcurl.so.4" "${filesdir}/bin/lib32/libcurl-gnutls.so.4" ln -s "/usr/lib/libcurl.so.4" "${serverfiles}/bin/lib32/libcurl-gnutls.so.4"
fn_fix_msg_end fn_fix_msg_end
fi fi

View File

@ -9,7 +9,7 @@ local commandaction="Fix"
# Fixes: ./srcds_linux: error while loading shared libraries: libtier0.so: cannot open shared object file: No such file or directory. # Fixes: ./srcds_linux: error while loading shared libraries: libtier0.so: cannot open shared object file: No such file or directory.
export LD_LIBRARY_PATH=${filesdir}:${filesdir}/bin:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH=${serverfiles}:${serverfiles}/bin:${LD_LIBRARY_PATH}
# Fixes: issue #529 - gamemode not passed to debug or start. # Fixes: issue #529 - gamemode not passed to debug or start.

View File

@ -10,8 +10,8 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
echo "Applying WebAdmin ROOst.css fix." echo "Applying WebAdmin ROOst.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
sed -i 's/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
sleep 1 sleep 1
echo "Applying WebAdmin CharSet fix." echo "Applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"

View File

@ -10,8 +10,8 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
echo "Applying WebAdmin ROOst.css fix." echo "Applying WebAdmin ROOst.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
sed -i 's/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
sleep 1 sleep 1
echo "Applying WebAdmin CharSet fix." echo "Applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"

View File

@ -23,21 +23,21 @@ if [ "${gamename}" == "Serious Sam 3: BFE" ]; then
fixname="libsteam.so" fixname="libsteam.so"
fn_fix_msg_start fn_fix_msg_start
mkdir -pv "${HOME}/.steam/bin32" >> "${scriptlog}" mkdir -pv "${HOME}/.steam/bin32" >> "${scriptlog}"
cp -v "${filesdir}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${scriptlog}" cp -v "${serverfiles}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${scriptlog}"
fn_fix_msg_end fn_fix_msg_end
fi fi
elif [ "${gamename}" == "Hurtworld" ]; then elif [ "${gamename}" == "Hurtworld" ]; then
# Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so. # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so.
if [ ! -f "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then
fixname="steamclient.so x86" fixname="steamclient.so x86"
fn_fix_msg_start fn_fix_msg_start
cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${scriptlog}" cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${scriptlog}"
fn_fix_msg_end fn_fix_msg_end
fi fi
if [ ! -f "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then
fixname="steamclient.so x86_64" fixname="steamclient.so x86_64"
fn_fix_msg_start fn_fix_msg_start
cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${scriptlog}" cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${scriptlog}"
fn_fix_msg_end fn_fix_msg_end
fi fi
elif [ "${gamename}" == "Tower Unite" ]; then elif [ "${gamename}" == "Tower Unite" ]; then
@ -45,7 +45,7 @@ elif [ "${gamename}" == "Tower Unite" ]; then
if [ ! -f "${executabledir}/steamclient.so" ]; then if [ ! -f "${executabledir}/steamclient.so" ]; then
fixname="steamclient.so" fixname="steamclient.so"
fn_fix_msg_start fn_fix_msg_start
cp -v "${filesdir}/linux64/steamclient.so" "${executabledir}/steamclient.so" >> "${scriptlog}" cp -v "${serverfiles}/linux64/steamclient.so" "${executabledir}/steamclient.so" >> "${scriptlog}"
fn_fix_msg_end fn_fix_msg_end
fi fi
fi fi

View File

@ -10,8 +10,8 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
echo "applying WebAdmin ut2003.css fix." echo "applying WebAdmin ut2003.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${filesdir}/Web/ServerAdmin/ut2003.css" sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ut2003.css"
sed -i 's/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ut2003.css" sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ut2003.css"
sleep 1 sleep 1
echo "applying WebAdmin CharSet fix." echo "applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"

View File

@ -95,13 +95,13 @@ if [ -z "${rootdirdu}" ]; then
fi fi
## LinuxGSM used space in serverfiles dir. ## LinuxGSM used space in serverfiles dir.
filesdirdu=$(du -sh "${filesdir}" 2> /dev/null | awk '{print $1}') filesdirdu=$(du -sh "${serverfiles}" 2> /dev/null | awk '{print $1}')
if [ -z "${filesdirdu}" ]; then if [ -z "${filesdirdu}" ]; then
filesdirdu="0M" filesdirdu="0M"
fi fi
## LinuxGSM used space total minus backup dir. ## LinuxGSM used space total minus backup dir.
rootdirduexbackup=$(du -sh --exclude="${backupdir}" "${filesdir}" 2> /dev/null | awk '{print $1}') rootdirduexbackup=$(du -sh --exclude="${backupdir}" "${serverfiles}" 2> /dev/null | awk '{print $1}')
if [ -z "${rootdirduexbackup}" ]; then if [ -z "${rootdirduexbackup}" ]; then
rootdirduexbackup="0M" rootdirduexbackup="0M"
fi fi

View File

@ -12,4 +12,4 @@ echo "Creating initial Factorio savefile"
echo "=================================" echo "================================="
sleep 1 sleep 1
check_glibc.sh check_glibc.sh
"${executabledir}"/factorio --create ${filesdir}/save1 "${executabledir}"/factorio --create ${serverfiles}/save1

View File

@ -11,7 +11,7 @@ sleep 1
echo "You are required to accept the EULA:" echo "You are required to accept the EULA:"
echo "https://account.mojang.com/documents/minecraft_eula" echo "https://account.mojang.com/documents/minecraft_eula"
echo "eula=false" > "${filesdir}/eula.txt" echo "eula=false" > "${serverfiles}/eula.txt"
if [ -z "${autoinstall}" ]; then if [ -z "${autoinstall}" ]; then
echo "By continuing you are indicating your agreement to the EULA." echo "By continuing you are indicating your agreement to the EULA."
@ -25,4 +25,4 @@ echo ""
sleep 5 sleep 5
fi fi
sed -i "s/eula=false/eula=true/g" "${filesdir}/eula.txt" sed -i "s/eula=false/eula=true/g" "${serverfiles}/eula.txt"

View File

@ -12,7 +12,7 @@ echo ""
echo "Server Directory" echo "Server Directory"
echo "=================================" echo "================================="
sleep 1 sleep 1
if [ -d "${filesdir}" ]; then if [ -d "${serverfiles}" ]; then
fn_print_warning_nl "A server is already installed here." fn_print_warning_nl "A server is already installed here."
fi fi
pwd pwd
@ -22,7 +22,7 @@ if [ -z "${autoinstall}" ]; then
exit exit
fi fi
fi fi
if [ ! -d "${filesdir}" ]; then if [ ! -d "${serverfiles}" ]; then
mkdir -v "${filesdir}" mkdir -v "${serverfiles}"
fi fi
sleep 1 sleep 1

View File

@ -24,11 +24,11 @@ fn_install_server_files(){
elif [ "${gamename}" == "GoldenEye: Source" ]; then elif [ "${gamename}" == "GoldenEye: Source" ]; then
fileurl="http://files.gameservermanagers.com/GoldenEyeSource/GoldenEye_Source_v5.0.1_full_server_linux.tar.bz2"; filedir="${tmpdir}"; filename="GoldenEye_Source_v5.0.1_server_full_Linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="ea227a150300abe346e757380325f84c" fileurl="http://files.gameservermanagers.com/GoldenEyeSource/GoldenEye_Source_v5.0.1_full_server_linux.tar.bz2"; filedir="${tmpdir}"; filename="GoldenEye_Source_v5.0.1_server_full_Linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="ea227a150300abe346e757380325f84c"
elif [ "${gamename}" == "Quake 2" ]; then elif [ "${gamename}" == "Quake 2" ]; then
fileurl="http://files.gameservermanagers.com/Quake2/quake2-3.20-glibc-i386-full-linux2.0.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="quake2-3.20-glibc-i386-full-linux2.0.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="0b8c7e2d51f40b56b328c69e986e7c5f" fileurl="http://files.gameservermanagers.com/Quake2/quake2-3.20-glibc-i386-full-linux2.0.tar.bz2"; filedir="${tmpdir}"; filename="quake2-3.20-glibc-i386-full-linux2.0.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="0b8c7e2d51f40b56b328c69e986e7c5f"
elif [ "${gamename}" == "Quake 3: Arena" ]; then elif [ "${gamename}" == "Quake 3: Arena" ]; then
fileurl="http://files.gameservermanagers.com/Quake3/quake3-1.32c-x86-full-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="quake3-1.32c-x86-full-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="fd7258d827474f67663dda297bff4306" fileurl="http://files.gameservermanagers.com/Quake3/quake3-1.32c-x86-full-linux.tar.bz2"; filedir="${tmpdir}"; filename="quake3-1.32c-x86-full-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="fd7258d827474f67663dda297bff4306"
elif [ "${gamename}" == "QuakeWorld" ]; then elif [ "${gamename}" == "QuakeWorld" ]; then
fileurl="http://files.gameservermanagers.com/QuakeWorld/nquake.server.linux.083116.full.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="nquake.server.linux.083116.full.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="75a409cf08d808f075e4dacdc7b21b78" fileurl="http://files.gameservermanagers.com/QuakeWorld/nquake.server.linux.083116.full.tar.bz2"; filedir="${tmpdir}"; filename="nquake.server.linux.083116.full.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="75a409cf08d808f075e4dacdc7b21b78"
elif [ "${gamename}" == "Unreal Tournament 2004" ]; then elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
fileurl="http://files.gameservermanagers.com/UnrealTournament2004/ut2004-server-3339-ultimate-linux.tar.bz2"; filedir="${tmpdir}"; filename="ut2004-server-3339-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54" fileurl="http://files.gameservermanagers.com/UnrealTournament2004/ut2004-server-3339-ultimate-linux.tar.bz2"; filedir="${tmpdir}"; filename="ut2004-server-3339-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54"
elif [ "${gamename}" == "Unreal Tournament 99" ]; then elif [ "${gamename}" == "Unreal Tournament 99" ]; then
@ -41,7 +41,7 @@ fn_install_server_files(){
fileurl="http://files.gameservermanagers.com/WolfensteinEnemyTerritory/enemy-territory.260b.tar.bz2"; filedir="${tmpdir}"; filename="enemy-territory.260b.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="f833f514bfcdd46b42c111f83350c5a7" fileurl="http://files.gameservermanagers.com/WolfensteinEnemyTerritory/enemy-territory.260b.tar.bz2"; filedir="${tmpdir}"; filename="enemy-territory.260b.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="f833f514bfcdd46b42c111f83350c5a7"
fi fi
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
fn_dl_extract "${filedir}" "${filename}" "${filesdir}" fn_dl_extract "${filedir}" "${filename}" "${serverfiles}"
} }
fn_install_server_files_steamcmd(){ fn_install_server_files_steamcmd(){
@ -62,8 +62,8 @@ fn_install_server_files_steamcmd(){
fi fi
if [ "${counter}" -ge "7" ]; then if [ "${counter}" -ge "7" ]; then
echo "Removing $(find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$')" echo "Removing $(find ${serverfiles} -type d -print0 | grep -Ez '[^/]{30}$')"
find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf find ${serverfiles} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf
fi fi
if [ "${counter}" -ge "9" ]; then if [ "${counter}" -ge "9" ]; then
rm -rf "${rootdir}/steamcmd" rm -rf "${rootdir}/steamcmd"
@ -78,18 +78,18 @@ fn_install_server_files_steamcmd(){
if [ "${counter}" -le "4" ]; then if [ "${counter}" -le "4" ]; then
if [ "${engine}" == "goldsource" ]; then if [ "${engine}" == "goldsource" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit
local exitcode=$? local exitcode=$?
else else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} +quit ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit
local exitcode=$? local exitcode=$?
fi fi
elif [ "${counter}" -ge "5" ]; then elif [ "${counter}" -ge "5" ]; then
if [ "${engine}" == "goldsource" ]; then if [ "${engine}" == "goldsource" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} -validate +quit ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} -validate +quit
local exitcode=$? local exitcode=$?
else else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} -validate +quit ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} -validate +quit
local exitcode=$? local exitcode=$?
fi fi
fi fi
@ -107,7 +107,7 @@ fn_install_server_files_steamcmd(){
counter="0" counter="0"
while [ "${counter}" -le "4" ]; do while [ "${counter}" -le "4" ]; do
counter=$((counter+1)) counter=$((counter+1))
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} -validate +quit ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} -validate +quit
local exitcode=$? local exitcode=$?
done done
fi fi

View File

@ -14,7 +14,7 @@ fn_install_ts3db_mariadb(){
echo "checking if libmariadb2 is installed" echo "checking if libmariadb2 is installed"
echo "=================================" echo "================================="
sleep 1 sleep 1
ldd ${filesdir}/libts3db_mariadb.so | grep "libmariadb.so.2 => not found" ldd ${serverfiles}/libts3db_mariadb.so | grep "libmariadb.so.2 => not found"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "libmariadb2 not installed. Please install it first." echo "libmariadb2 not installed. Please install it first."
echo "exiting..." echo "exiting..."

View File

@ -11,7 +11,7 @@ sleep 1
echo "You are required to accept the EULA:" echo "You are required to accept the EULA:"
echo "https://www.epicgames.com/unrealtournament/unreal-tournament-pre-alpha-test-development-build-eula/" echo "https://www.epicgames.com/unrealtournament/unreal-tournament-pre-alpha-test-development-build-eula/"
echo "eula=false" > "${filesdir}/eula.txt" echo "eula=false" > "${serverfiles}/eula.txt"
if [ -z "${autoinstall}" ]; then if [ -z "${autoinstall}" ]; then
echo "By continuing you are indicating your agreement to the EULA." echo "By continuing you are indicating your agreement to the EULA."
@ -25,4 +25,4 @@ echo ""
sleep 5 sleep 5
fi fi
sed -i "s/eula=false/eula=true/g" "${filesdir}/eula.txt" sed -i "s/eula=false/eula=true/g" "${serverfiles}/eula.txt"

View File

@ -12,9 +12,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_update_factorio_dl(){ fn_update_factorio_dl(){
fn_fetch_file "https://www.factorio.com/get-download/${availablebuild}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.gz" fn_fetch_file "https://www.factorio.com/get-download/${availablebuild}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.gz"
fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.gz" "${tmpdir}" fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.gz" "${tmpdir}"
echo -e "copying to ${filesdir}...\c" echo -e "copying to ${serverfiles}...\c"
fn_script_log "Copying to ${filesdir}" fn_script_log "Copying to ${serverfiles}"
cp -R "${tmpdir}/factorio/"* "${filesdir}" cp -R "${tmpdir}/factorio/"* "${serverfiles}"
local exitcode=$? local exitcode=$?
if [ "${exitcode}" == "0" ]; then if [ "${exitcode}" == "0" ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl

View File

@ -10,9 +10,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_update_dl(){ fn_update_dl(){
fn_fetch_file "https://s3.amazonaws.com/Minecraft.Download/versions/${availablebuild}/minecraft_server.${availablebuild}.jar" "${tmpdir}" "minecraft_server.${availablebuild}.jar" fn_fetch_file "https://s3.amazonaws.com/Minecraft.Download/versions/${availablebuild}/minecraft_server.${availablebuild}.jar" "${tmpdir}" "minecraft_server.${availablebuild}.jar"
echo -e "copying to ${filesdir}...\c" echo -e "copying to ${serverfiles}...\c"
fn_script_log "Copying to ${filesdir}" fn_script_log "Copying to ${serverfiles}"
cp "${tmpdir}/minecraft_server.${availablebuild}.jar" "${filesdir}/minecraft_server.jar" cp "${tmpdir}/minecraft_server.${availablebuild}.jar" "${serverfiles}/minecraft_server.jar"
local exitcode=$? local exitcode=$?
if [ ${exitcode} -eq 0 ]; then if [ ${exitcode} -eq 0 ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl
@ -47,7 +47,7 @@ fn_update_currentbuild(){
fi fi
# Get current build from logs # Get current build from logs
currentbuild=$(cat "${filesdir}/logs/latest.log" 2> /dev/null | grep version | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') currentbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
if [ -z "${currentbuild}" ]; then if [ -z "${currentbuild}" ]; then
fn_print_error_nl "Checking for update: mojang.com: Current build version not found" fn_print_error_nl "Checking for update: mojang.com: Current build version not found"
fn_script_log_error "Checking for update: mojang.com: Current build version not found" fn_script_log_error "Checking for update: mojang.com: Current build version not found"
@ -58,7 +58,7 @@ fn_update_currentbuild(){
command_stop.sh command_stop.sh
exitbypass=1 exitbypass=1
command_start.sh command_start.sh
currentbuild=$(cat "${filesdir}/logs/latest.log" 2> /dev/null | grep version | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') currentbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
if [ -z "${currentbuild}" ]; then if [ -z "${currentbuild}" ]; then
fn_print_fail_nl "Checking for update: mojang.com: Current build version still not found" fn_print_fail_nl "Checking for update: mojang.com: Current build version still not found"
fn_script_log_fatal "Checking for update: mojang.com: Current build version still not found" fn_script_log_fatal "Checking for update: mojang.com: Current build version still not found"

View File

@ -12,9 +12,9 @@ fn_update_mta_dl(){
fn_fetch_file "http://linux.mtasa.com/dl/${numversion}/multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz" fn_fetch_file "http://linux.mtasa.com/dl/${numversion}/multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz"
mkdir "${tmpdir}/multitheftauto_linux_x64-${fullversion}" mkdir "${tmpdir}/multitheftauto_linux_x64-${fullversion}"
fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}/multitheftauto_linux_x64-${fullversion}" fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}/multitheftauto_linux_x64-${fullversion}"
echo -e "copying to ${filesdir}...\c" echo -e "copying to ${serverfiles}...\c"
fn_script_log "Copying to ${filesdir}" fn_script_log "Copying to ${serverfiles}"
cp -R "${tmpdir}/multitheftauto_linux_x64-${fullversion}/multitheftauto_linux_x64-${fullversion}/"* "${filesdir}" cp -R "${tmpdir}/multitheftauto_linux_x64-${fullversion}/multitheftauto_linux_x64-${fullversion}/"* "${serverfiles}"
local exitcode=$? local exitcode=$?
if [ "${exitcode}" == "0" ]; then if [ "${exitcode}" == "0" ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl

View File

@ -12,9 +12,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_update_mumble_dl(){ fn_update_mumble_dl(){
fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${availablebuild}/murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${availablebuild}/murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2"
fn_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" fn_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}"
echo -e "copying to ${filesdir}...\c" echo -e "copying to ${serverfiles}...\c"
fn_script_log "Copying to ${filesdir}" fn_script_log "Copying to ${serverfiles}"
cp -R "${tmpdir}/murmur-static_${mumblearch}-${availablebuild}/"* "${filesdir}" cp -R "${tmpdir}/murmur-static_${mumblearch}-${availablebuild}/"* "${serverfiles}"
local exitcode=$? local exitcode=$?
if [ ${exitcode} -eq 0 ]; then if [ ${exitcode} -eq 0 ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl

View File

@ -26,17 +26,17 @@ fn_update_steamcmd_dl(){
fi fi
if [ "${engine}" == "goldsource" ]; then if [ "${engine}" == "goldsource" ]; then
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +quit | tee -a "${scriptlog}" ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +quit | tee -a "${scriptlog}"
else else
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} +quit | tee -a "${scriptlog}" ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit | tee -a "${scriptlog}"
fi fi
fix.sh fix.sh
} }
fn_appmanifest_info(){ fn_appmanifest_info(){
appmanifestfile=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf") appmanifestfile=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf")
appmanifestfilewc=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf"|wc -l) appmanifestfilewc=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf"|wc -l)
} }
fn_appmanifest_check(){ fn_appmanifest_check(){

View File

@ -11,9 +11,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_update_ts3_dl(){ fn_update_ts3_dl(){
fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}"
echo -e "copying to ${filesdir}...\c" echo -e "copying to ${serverfiles}...\c"
fn_script_log "Copying to ${filesdir}" fn_script_log "Copying to ${serverfiles}"
cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}"
local exitcode=$? local exitcode=$?
if [ "${exitcode}" == "0" ]; then if [ "${exitcode}" == "0" ]; then
fn_print_ok_eol_nl fn_print_ok_eol_nl

View File

@ -26,13 +26,13 @@ lgsmdir="${rootdir}/lgsm"
functionsdir="${lgsmdir}/functions" functionsdir="${lgsmdir}/functions"
libdir="${lgsmdir}/lib" libdir="${lgsmdir}/lib"
tmpdir="${lgsmdir}/tmp" tmpdir="${lgsmdir}/tmp"
filesdir="${rootdir}/serverfiles" serverfiles="${rootdir}/serverfiles"
configdir="${lgsmdir}/config-lgsm" configdir="${lgsmdir}/config-lgsm"
configdirserver="${configdir}/${servername}" configdirserver="${configdir}/${servername}"
configdirdefault="${lgsmdir}/config-default" configdirdefault="${lgsmdir}/config-default"
## Github Branch Select ## GitHub Branch Select
# Allows for the use of different function files # Allows for the use of different function files
# from a different repo and/or branch. # from a different repo and/or branch.
githubuser="GameServerManagers" githubuser="GameServerManagers"
@ -42,7 +42,7 @@ githubbranch="feature/config"
# Core Function that is required first # Core Function that is required first
core_functions.sh(){ core_functions.sh(){
functionfile="${FUNCNAME}" functionfile="${FUNCNAME}"
fn_bootstrap_fetch_file fn_bootstrap_fetch_file "lgsm/functions" "core_functions.sh" "${functionsdir}" "_default.cfg" "noexecutecmd" "norun" "noforce" "nomd5"
} }
# Bootstrap # Bootstrap
@ -50,16 +50,13 @@ core_functions.sh(){
# Fetches core functions # Fetches core functions
fn_bootstrap_fetch_file(){ fn_bootstrap_fetch_file(){
github_file_url_dir="lgsm/functions" # github dir containing the file fileurl="${1}"
github_file_url_name="${functionfile}" # name of the github file filedir="${2}"
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" filename="${3}"
fileurl="${githuburl}" executecmd="${4:-0}"
filedir="${functionsdir}" run="${5:-0}"
filename="${github_file_url_name}" force="${6:-0}"
executecmd="executecmd" md5="${7:-0}"
run="run"
force="noforce"
md5="nomd5"
# If the file is missing, then download # If the file is missing, then download
if [ ! -f "${filedir}/${filename}" ]; then if [ ! -f "${filedir}/${filename}" ]; then
if [ ! -d "${filedir}" ]; then if [ ! -d "${filedir}" ]; then
@ -252,7 +249,7 @@ if [ "${shortname}" == "core" ]; then
# Download the serverlist. This is the complete list of all supported servers. # Download the serverlist. This is the complete list of all supported servers.
# Download to tmp dir # Download to tmp dir
fn_boostrap_fetch_config "lgsm/data" "serverlist.csv" "${tmpdir}/data" "serverlist.csv" "noexecutecmd" "norun" "noforce" "nomd5" fn_boostrap_fetch_file "lgsm/data" "serverlist.csv" "${tmpdir}/data" "serverlist.csv" "noexecutecmd" "norun" "noforce" "nomd5"
# if missing in lgsm dir copy it accross # if missing in lgsm dir copy it accross
if [ ! -f "${serverlist}" ]; then if [ ! -f "${serverlist}" ]; then
mkdir -p "${datadir}" mkdir -p "${datadir}"

View File

@ -93,12 +93,12 @@ tmpdir="${lgsmdir}/tmp"
filesdir="${rootdir}/serverfiles" filesdir="${rootdir}/serverfiles"
## Server Specific Directories ## Server Specific Directories
systemdir="${filesdir}" systemdir="${serverfiles}"
executabledir="${filesdir}" executabledir="${serverfiles}"
executable="./Jcmp-Server" executable="./Jcmp-Server"
servercfg="config.lua" servercfg="config.lua"
servercfgdefault="config.lua" servercfgdefault="config.lua"
servercfgdir="${filesdir}" servercfgdir="${serverfiles}"
servercfgfullpath="${servercfgdir}/${servercfg}" servercfgfullpath="${servercfgdir}/${servercfg}"
## Backup Directory ## Backup Directory
@ -443,7 +443,7 @@ echo "Command: ./jc2server update"
requiredstatus="OFFLINE" requiredstatus="OFFLINE"
fn_setstatus fn_setstatus
fn_print_info_nl "changed buildid to 0." fn_print_info_nl "changed buildid to 0."
sed -i 's/[0-9]\+/0/' "${filesdir}/steamapps/appmanifest_${appid}.acf" sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf"
(command_update.sh) (command_update.sh)
fn_test_result_pass fn_test_result_pass
@ -456,7 +456,7 @@ echo "Command: ./jc2server update"
requiredstatus="ONLINE" requiredstatus="ONLINE"
fn_setstatus fn_setstatus
fn_print_info_nl "changed buildid to 0." fn_print_info_nl "changed buildid to 0."
sed -i 's/[0-9]\+/0/' "${filesdir}/steamapps/appmanifest_${appid}.acf" sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf"
(command_update.sh) (command_update.sh)
fn_test_result_pass fn_test_result_pass
@ -469,7 +469,7 @@ echo "Command: ./jc2server update"
requiredstatus="OFFLINE" requiredstatus="OFFLINE"
fn_setstatus fn_setstatus
fn_print_info_nl "removed appmanifest_${appid}.acf." fn_print_info_nl "removed appmanifest_${appid}.acf."
rm --verbose "${filesdir}/steamapps/appmanifest_${appid}.acf" rm --verbose "${serverfiles}/steamapps/appmanifest_${appid}.acf"
(command_update.sh) (command_update.sh)
fn_test_result_pass fn_test_result_pass

View File

@ -80,19 +80,19 @@ tmpdir="${lgsmdir}/tmp"
filesdir="${rootdir}/serverfiles" filesdir="${rootdir}/serverfiles"
## Server Specific Directories ## Server Specific Directories
systemdir="${filesdir}" systemdir="${serverfiles}"
executabledir="${filesdir}" executabledir="${serverfiles}"
executable="./ts3server_startscript.sh" executable="./ts3server_startscript.sh"
servercfg="${servicename}.ini" servercfg="${servicename}.ini"
servercfgdefault="ts3server.ini" servercfgdefault="ts3server.ini"
servercfgdir="${filesdir}" servercfgdir="${serverfiles}"
servercfgfullpath="${servercfgdir}/${servercfg}" servercfgfullpath="${servercfgdir}/${servercfg}"
## Backup Directory ## Backup Directory
backupdir="${rootdir}/backups" backupdir="${rootdir}/backups"
## Logging Directories ## Logging Directories
gamelogdir="${filesdir}/logs" gamelogdir="${serverfiles}/logs"
scriptlogdir="${rootdir}/log/script" scriptlogdir="${rootdir}/log/script"
scriptlog="${scriptlogdir}/${servicename}-script.log" scriptlog="${scriptlogdir}/${servicename}-script.log"
emaillog="${scriptlogdir}/${servicename}-email.log" emaillog="${scriptlogdir}/${servicename}-email.log"