diff --git a/README.md b/README.md index 72e57fa62..3a6cf9d5a 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ If you want to donate to the project you can via PayPal. I have had a may kind p
  • Wiki
  • GitHub Code
  • GitHub Issues
  • -
  • Waffle (Github Dashboard)
  • +
  • Waffle (GitHub Dashboard)
  • alternativeTo.net
  • Social

    diff --git a/lgsm/config-default/config-lgsm/arkserver/_default.cfg b/lgsm/config-default/config-lgsm/arkserver/_default.cfg index 6c4d453bf..8378e9cec 100644 --- a/lgsm/config-default/config-lgsm/arkserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/arkserver/_default.cfg @@ -65,7 +65,7 @@ engine="unreal4" # Edit with care ## Server Specific Directories -systemdir="${filesdir}/ShooterGame" +systemdir="${serverfiles}/ShooterGame" executabledir="${systemdir}/Binaries/Linux" executable="./ShooterGameServer" servercfgdir="${systemdir}/Saved/Config/LinuxServer" diff --git a/lgsm/config-default/config-lgsm/arma3server/_default.cfg b/lgsm/config-default/config-lgsm/arma3server/_default.cfg index f551c8d66..4dc8a264c 100644 --- a/lgsm/config-default/config-lgsm/arma3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/arma3server/_default.cfg @@ -73,8 +73,8 @@ engine="realvirtuality" # Edit with care ## Server Specific Directories -systemdir="${filesdir}" -executabledir="${filesdir}" +systemdir="${serverfiles}" +executabledir="${serverfiles}" executable="./arma3server" servercfg="${servicename}.server.cfg" networkcfg="${servicename}.network.cfg" diff --git a/lgsm/config-default/config-lgsm/csgoserver/_default.cfg b/lgsm/config-default/config-lgsm/csgoserver/_default.cfg index 3c7a1aea8..fdbb7a272 100644 --- a/lgsm/config-default/config-lgsm/csgoserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/csgoserver/_default.cfg @@ -89,8 +89,8 @@ engine="source" # Edit with care ## Server Specific Directories -systemdir="${filesdir}/csgo" -executabledir="${filesdir}" +systemdir="${serverfiles}/csgo" +executabledir="${serverfiles}" executable="./srcds_run" servercfg="${servicename}.cfg" servercfgdefault="server.cfg" diff --git a/lgsm/config-default/config-lgsm/sdtdserver/_default.cfg b/lgsm/config-default/config-lgsm/sdtdserver/_default.cfg index ad8476ddb..d537643cc 100644 --- a/lgsm/config-default/config-lgsm/sdtdserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/sdtdserver/_default.cfg @@ -65,12 +65,12 @@ engine="unity3d" # Edit with care ## Server Specific Directories -systemdir="${filesdir}" -executabledir="${filesdir}" +systemdir="${serverfiles}" +executabledir="${serverfiles}" executable="./7DaysToDieServer.x86" servercfg="${servicename}.xml" servercfgdefault="serverconfig.xml" -servercfgdir="${filesdir}" +servercfgdir="${serverfiles}" servercfgfullpath="${servercfgdir}/${servercfg}" ## Backup Directory diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh index 24648f2ec..61cd9d472 100644 --- a/lgsm/functions/check_permissions.sh +++ b/lgsm/functions/check_permissions.sh @@ -18,8 +18,8 @@ fn_check_ownership(){ funcownissue=1 fi fi - if [ -d "${filesdir}" ]; then - if [ $(find "${filesdir}" -not -user $(whoami)|wc -l) -ne "0" ]; then + if [ -d "${serverfiles}" ]; then + if [ $(find "${serverfiles}" -not -user $(whoami)|wc -l) -ne "0" ]; then filesownissue=1 fi fi @@ -37,7 +37,7 @@ fn_check_ownership(){ find "${functionsdir}" -not -user $(whoami) -printf "%u\t\t%g\t%p\n" fi 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 } | column -s $'\t' -t | tee -a "${scriptlog}" diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh index 536a12c2a..12f3e3069 100644 --- a/lgsm/functions/command_dev_detect_glibc.sh +++ b/lgsm/functions/command_dev_detect_glibc.sh @@ -15,21 +15,21 @@ if [ -z "$(command -v objdump)" ]; then core_exit.sh fi -if [ -z "${filesdir}" ]; then +if [ -z "${serverfiles}" ]; then dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" fi -if [ -d "${filesdir}" ]; then +if [ -d "${serverfiles}" ]; then echo "Checking directory: " - echo "${filesdir}" -elif [ -f "${filesdir}" ]; then + echo "${serverfiles}" +elif [ -f "${serverfiles}" ]; then echo "Checking file: " - echo "${filesdir}" + echo "${serverfiles}" fi echo "" -files=$(find ${filesdir} | wc -l) -find ${filesdir} -type f -print0 | +files=$(find ${serverfiles} | wc -l) +find ${serverfiles} -type f -print0 | while IFS= read -r -d $'\0' line; do objdump -T $line 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc.tmp" echo -n "$i / $files" $'\r' diff --git a/lgsm/functions/command_dev_detect_ldd.sh b/lgsm/functions/command_dev_detect_ldd.sh index 4e1c7b2b3..312b037a4 100644 --- a/lgsm/functions/command_dev_detect_ldd.sh +++ b/lgsm/functions/command_dev_detect_ldd.sh @@ -9,21 +9,21 @@ echo "=================================" echo "Shared Object dependencies Checker" echo "=================================" -if [ -z "${filesdir}" ]; then +if [ -z "${serverfiles}" ]; then dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" fi -if [ -d "${filesdir}" ]; then +if [ -d "${serverfiles}" ]; then echo "Checking directory: " - echo "${filesdir}" -elif [ -f "${filesdir}" ]; then + echo "${serverfiles}" +elif [ -f "${serverfiles}" ]; then echo "Checking file: " - echo "${filesdir}" + echo "${serverfiles}" fi echo "" -files=$(find "${filesdir}" | wc -l) -find "${filesdir}" -type f -print0 | +files=$(find "${serverfiles}" | wc -l) +find "${serverfiles}" -type f -print0 | while IFS= read -r -d $'\0' line; do #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 diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index fe88c43ce..3996f523e 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -252,7 +252,7 @@ fn_stop_ark(){ if [ -z "${queryport}" ]; then fn_print_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" queryport=$(grep ^QueryPort= ${userconfigfile} | cut -d= -f2 | sed "s/[^[:digit:].*].*//g") fi @@ -291,7 +291,7 @@ fn_stop_ark(){ fn_stop_teamspeak3(){ fn_print_dots "${servername}" sleep 0.5 - "${filesdir}"/ts3server_startscript.sh stop > /dev/null 2>&1 + "${serverfiles}"/ts3server_startscript.sh stop > /dev/null 2>&1 check_status.sh if [ "${status}" == "0" ]; then # Remove lockfile diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index eb6d13c15..f2fa5638b 100644 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -27,9 +27,9 @@ fn_validation(){ fi 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 - ${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 if [ $? != 0 ]; then fn_print_fail_nl "Validating files: SteamCMD" diff --git a/lgsm/functions/compress_unreal2_maps.sh b/lgsm/functions/compress_unreal2_maps.sh index 7ef8bfeea..abd84f414 100644 --- a/lgsm/functions/compress_unreal2_maps.sh +++ b/lgsm/functions/compress_unreal2_maps.sh @@ -21,10 +21,10 @@ if ! fn_prompt_yn "Start compression?" Y; then echo Exiting; return fi mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 -rm -rfv "${filesdir}/Maps/"*.ut2.uz2 +rm -rfv "${serverfiles}/Maps/"*.ut2.uz2 cd "${systemdir}" -for map in "${filesdir}/Maps/"*; do +for map in "${serverfiles}/Maps/"*; do ./ucc-bin compress "${map}" --nohomedir done -mv -fv "${filesdir}/Maps/"*.ut2.uz2 "${compressedmapsdir}" +mv -fv "${serverfiles}/Maps/"*.ut2.uz2 "${compressedmapsdir}" core_exit.sh diff --git a/lgsm/functions/compress_ut99_maps.sh b/lgsm/functions/compress_ut99_maps.sh index e74ec727c..e81117e7b 100644 --- a/lgsm/functions/compress_ut99_maps.sh +++ b/lgsm/functions/compress_ut99_maps.sh @@ -21,10 +21,10 @@ if ! fn_prompt_yn "Start compression?" Y; then echo Exiting; return fi mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1 -rm -rfv "${filesdir}/Maps/"*.unr.uz +rm -rfv "${serverfiles}/Maps/"*.unr.uz cd "${systemdir}" -for map in "${filesdir}/Maps/"*; do +for map in "${serverfiles}/Maps/"*; do ./ucc-bin compress "${map}" --nohomedir done -mv -fv "${filesdir}/Maps/"*.unr.uz "${compressedmapsdir}" +mv -fv "${serverfiles}/Maps/"*.unr.uz "${compressedmapsdir}" core_exit.sh diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index 7d51d91da..7d24f9436 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -5,17 +5,17 @@ # Website: https://gameservermanagers.com # Description: Deals with all downloads for LinuxGSM. -# 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 -# 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 -# run: Optional, set to run to execute the file -# force: Optional, force re-download of file even if exists -# md5: Optional, Checks file against an md5 sum +# remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2 +# local_filedir: location the file is to be saved: /home/server/lgsm/tmp +# local_filename: name of file (this can be different from the url name): file.tar.bz2 +# chmodx: Optional, set to "chmodx" to make file executable using chmod +x +# run: Optional, set run to execute the file after download +# forcedl: Optional, force re-download of file even if exists +# md5: Optional, set an md5 sum and will compare it against the file. # # Downloads can be defined in code like so: -# fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" -# fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "executecmd" "run" "force" "10cd7353aa9d758a075c600a6dd193fd" +# 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" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd" local commandname="DOWNLOAD" local commandaction="Download" @@ -24,50 +24,50 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_dl_md5(){ # Runs MD5 Check if available if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then - echo -ne "verifying ${filename} with MD5..." + echo -ne "verifying ${local_filename} with MD5..." sleep 1 - local md5sumcmd=$(md5sum "${filedir}/${filename}"|awk '{print $1;}') + local md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}') if [ "${md5sumcmd}" != "${md5}" ]; then fn_print_fail_eol_nl - echo "${filename} returned MD5 checksum: ${md5sumcmd}" + echo "${local_filename} returned MD5 checksum: ${md5sumcmd}" echo "expected MD5 checksum: ${md5}" - fn_script_log_fatal "Verifying ${filename} with MD5: FAIL" - fn_script_log_info "${filename} returned MD5 checksum: ${md5sumcmd}" + fn_script_log_fatal "Verifying ${local_filename} with MD5: FAIL" + fn_script_log_info "${local_filename} returned MD5 checksum: ${md5sumcmd}" fn_script_log_info "Expected MD5 checksum: ${md5}" core_exit.sh else fn_print_ok_eol_nl - fn_script_log_pass "Verifying ${filename} with MD5: OK" - fn_script_log_info "${filename} returned MD5 checksum: ${md5sumcmd}" + fn_script_log_pass "Verifying ${local_filename} with MD5: OK" + fn_script_log_info "${local_filename} returned MD5 checksum: ${md5sumcmd}" fn_script_log_info "Expected MD5 checksum: ${md5}" fi fi } -# Extracts bzip2 or gzip or zip files +# Extracts bzip2, gzip or zip files # 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(){ - filedir="${1}" - filename="${2}" + local_filedir="${1}" + local_filename="${2}" extractdir="${3}" # extracts archives - echo -ne "extracting ${filename}..." - mime=$(file -b --mime-type "${filedir}/${filename}") + echo -ne "extracting ${local_filename}..." + mime=$(file -b --mime-type "${local_filedir}/${local_filename}") 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 - tarcmd=$(tar -jxf "${filedir}/${filename}" -C "${extractdir}") + extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}") elif [ "${mime}" == "application/zip" ]; then - tarcmd=$(unzip -d "${extractdir}" "${filedir}/${filename}") + extractcmd=$(unzip -d "${extractdir}" "${local_filedir}/${local_filename}") fi local exitcode=$? if [ ${exitcode} -ne 0 ]; then fn_print_fail_eol_nl fn_script_log_fatal "Extracting download: FAIL" - echo "${tarcmd}" | tee -a "${scriptlog}" + echo "${extractcmd}" | tee -a "${scriptlog}" core_exit.sh else fn_print_ok_eol_nl @@ -78,163 +78,155 @@ fn_dl_extract(){ # Trap to remove file download if canceled before completed fn_fetch_trap(){ echo "" - echo -ne "downloading ${filename}..." + echo -ne "downloading ${local_filename}..." fn_print_canceled_eol_nl - fn_script_log_info "Downloading ${filename}...CANCELED" + fn_script_log_info "Downloading ${local_filename}...CANCELED" sleep 1 - rm -f "${filedir}/${filename}" | tee -a "${scriptlog}" - echo -ne "downloading ${filename}..." + rm -f "${local_filedir}/${local_filename}" | tee -a "${scriptlog}" + echo -ne "downloading ${local_filename}..." fn_print_removed_eol_nl - fn_script_log_info "Downloading ${filename}...REMOVED" + fn_script_log_info "Downloading ${local_filename}...REMOVED" core_exit.sh } fn_fetch_file(){ - fileurl="${1}" - filedir="${2}" - filename="${3}" - executecmd="${4:-0}" + remote_fileurl="${1}" + local_filedir="${2}" + local_filename="${3}" + chmodx="${4:-0}" run="${5:-0}" - force="${6:-0}" + forcedl="${6:-0}" md5="${7:-0}" # If the file is missing, then download - if [ ! -f "${filedir}/${filename}" ]; then - if [ ! -d "${filedir}" ]; then - mkdir -p "${filedir}" + if [ ! -f "${local_filedir}/${local_filename}" ]; then + if [ ! -d "${local_filedir}" ]; then + mkdir -p "${local_filedir}" fi - - # Check curl exists and use available path - curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)" - for curlpath in ${curlpaths} - do - if [ -x "${curlpath}" ]; then - break - fi - 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 + # Trap will remove part downloaded files if canceled + trap fn_fetch_trap INT + # if larger file shows progress bar + if [ "${local_filename##*.}" == "bz2" ]||[ "${local_filename##*.}" == "gz" ]||[ "${local_filename##*.}" == "zip" ]||[ "${local_filename##*.}" == "jar" ]; then + echo -ne "downloading ${local_filename}..." + sleep 1 + curlcmd=$(${curlpath} --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}") + echo -ne "downloading ${local_filename}..." 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 - echo "Curl is not installed!" - echo -e "" if [ -f "${scriptlog}" ]; then - fn_script_log_fatal "Curl is not installed!" + fn_script_log_fatal "Downloading ${local_filename}: FAIL" fi + echo -e "${remote_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 ${local_filename}: OK" + fi fi - # make file executecmd if executecmd is set - if [ "${executecmd}" == "executecmd" ]; then - chmod +x "${filedir}/${filename}" + # Remove trap + trap - INT + # Make file executable if chmodx is set + if [ "${chmodx}" == "chmodx" ]; then + chmod +x "${local_filedir}/${local_filename}" fi fi - if [ -f "${filedir}/${filename}" ]; then + if [ -f "${local_filedir}/${local_filename}" ]; then fn_dl_md5 - # run file if run is set + # Execute file if run is set if [ "${run}" == "run" ]; then - source "${filedir}/${filename}" + source "${local_filedir}/${local_filename}" 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 -# filedir: name of file -# filename: location file to be saved -# 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 +# github_file_url_dir: the directory of the file in the GitHub: lgsm/functions +# github_file_url_name: the filename of the file to download from GitHub: core_messages.sh +# githuburl: the full GitHub url -fn_fetch_config(){ - github_file_url_dir="${1}" # github dir containing the file - github_file_url_name="${2}" # name of the github file - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - fileurl="${githuburl}" - filedir="${3}" - filename="${4}" - executecmd="noexecutecmd" - run="norun" - force="noforce" - md5="nomd5" - fn_boostrap_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" -} +# remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2 +# local_filedir: location the file is to be saved: /home/server/lgsm/tmp +# local_filename: name of file (this can be different from the url name): file.tar.bz2 +# chmodx: Optional, set to "chmodx" to make file executable using chmod +x +# run: Optional, set run to execute the file after download +# forcedl: Optional, force re-download of file even if exists +# md5: Optional, set an md5 sum and will compare it against the file. -# Fetches files from the github repo +# Fetches any files from the GitHub repo fn_fetch_file_github(){ 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}" - fileurl="${githuburl}" - filedir="${3}" - filename="${github_file_url_name}" - executecmd="${4:-0}" + + remote_fileurl="${githuburl}" + local_filedir="${3}" + local_filename="${github_file_url_name}" + chmodx="${4:-0}" run="${5:-0}" - force="${6:-0}" + forcedl="${6:-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 fn_fetch_function(){ - github_file_url_dir="lgsm/functions" # github dir containing the file - github_file_url_name="${functionfile}" # name of the github file + github_file_url_dir="lgsm/functions" + github_file_url_name="${functionfile}" githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - fileurl="${githuburl}" - filedir="${functionsdir}" - filename="${github_file_url_name}" - executecmd="executecmd" + + remote_fileurl="${githuburl}" + local_filedir="${functionsdir}" + local_filename="${github_file_url_name}" + chmodx="chmodx" run="run" - force="noforce" + forcedl="noforce" 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(){ exitbypass=1 - github_file_url_dir="lgsm/functions" # github dir containing the file - github_file_url_name="${functionfile}" # name of the github file + github_file_url_dir="lgsm/functions" + github_file_url_name="${functionfile}" githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - fileurl="${githuburl}" - filedir="${functionsdir}" - filename="${github_file_url_name}" - executecmd="executecmd" + + remote_fileurl="${githuburl}" + local_filedir="${functionsdir}" + local_filename="${github_file_url_name}" + chmodx="chmodx" run="norun" - force="noforce" + forcedl="noforce" 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 break fi -done \ No newline at end of file +done + +if [ "$(basename ${curlpath})" != "curl" ]; then + echo "[ FAIL ] Curl is not installed" + exit 1 +fi \ No newline at end of file diff --git a/lgsm/functions/fix_csgo.sh b/lgsm/functions/fix_csgo.sh index 305c0d06b..3dc840824 100644 --- a/lgsm/functions/fix_csgo.sh +++ b/lgsm/functions/fix_csgo.sh @@ -9,10 +9,10 @@ local commandaction="Fix" local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" # 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" fn_fix_msg_start - echo -n "730" >> "${filesdir}/steam_appid.txt" + echo -n "730" >> "${serverfiles}/steam_appid.txt" fn_fix_msg_end fi diff --git a/lgsm/functions/fix_dst.sh b/lgsm/functions/fix_dst.sh index 5a631a52e..0a6bbe8b9 100644 --- a/lgsm/functions/fix_dst.sh +++ b/lgsm/functions/fix_dst.sh @@ -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) # 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" 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 fi \ No newline at end of file diff --git a/lgsm/functions/fix_ins.sh b/lgsm/functions/fix_ins.sh index c132173b0..86fff41e7 100644 --- a/lgsm/functions/fix_ins.sh +++ b/lgsm/functions/fix_ins.sh @@ -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. -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. diff --git a/lgsm/functions/fix_kf.sh b/lgsm/functions/fix_kf.sh index a70f8ce86..515189d8c 100644 --- a/lgsm/functions/fix_kf.sh +++ b/lgsm/functions/fix_kf.sh @@ -10,8 +10,8 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" echo "Applying WebAdmin ROOst.css fix." 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/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" +sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css" +sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css" sleep 1 echo "Applying WebAdmin CharSet fix." echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" diff --git a/lgsm/functions/fix_ro.sh b/lgsm/functions/fix_ro.sh index 3498ee9c8..033245216 100644 --- a/lgsm/functions/fix_ro.sh +++ b/lgsm/functions/fix_ro.sh @@ -10,8 +10,8 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" echo "Applying WebAdmin ROOst.css fix." 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/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ROOst.css" +sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css" +sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css" sleep 1 echo "Applying WebAdmin CharSet fix." echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" diff --git a/lgsm/functions/fix_steamcmd.sh b/lgsm/functions/fix_steamcmd.sh index 79bf5acce..52762e10a 100644 --- a/lgsm/functions/fix_steamcmd.sh +++ b/lgsm/functions/fix_steamcmd.sh @@ -23,21 +23,21 @@ if [ "${gamename}" == "Serious Sam 3: BFE" ]; then fixname="libsteam.so" fn_fix_msg_start 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 fi elif [ "${gamename}" == "Hurtworld" ]; then # 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" 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 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" 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 fi elif [ "${gamename}" == "Tower Unite" ]; then @@ -45,7 +45,7 @@ elif [ "${gamename}" == "Tower Unite" ]; then if [ ! -f "${executabledir}/steamclient.so" ]; then fixname="steamclient.so" 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 fi fi diff --git a/lgsm/functions/fix_ut2k4.sh b/lgsm/functions/fix_ut2k4.sh index 913ef62e9..ae0088315 100644 --- a/lgsm/functions/fix_ut2k4.sh +++ b/lgsm/functions/fix_ut2k4.sh @@ -10,8 +10,8 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" echo "applying WebAdmin ut2003.css fix." 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/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ut2003.css" +sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ut2003.css" +sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ut2003.css" sleep 1 echo "applying WebAdmin CharSet fix." echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index d8d733d64..c83dff8a1 100644 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -95,13 +95,13 @@ if [ -z "${rootdirdu}" ]; then fi ## 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 filesdirdu="0M" fi ## 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 rootdirduexbackup="0M" fi diff --git a/lgsm/functions/install_factorio_save.sh b/lgsm/functions/install_factorio_save.sh index e76e97e9f..240c2a62a 100644 --- a/lgsm/functions/install_factorio_save.sh +++ b/lgsm/functions/install_factorio_save.sh @@ -12,4 +12,4 @@ echo "Creating initial Factorio savefile" echo "=================================" sleep 1 check_glibc.sh -"${executabledir}"/factorio --create ${filesdir}/save1 +"${executabledir}"/factorio --create ${serverfiles}/save1 diff --git a/lgsm/functions/install_minecraft_eula.sh b/lgsm/functions/install_minecraft_eula.sh index 7c172df1b..5ca97ac8e 100644 --- a/lgsm/functions/install_minecraft_eula.sh +++ b/lgsm/functions/install_minecraft_eula.sh @@ -11,7 +11,7 @@ sleep 1 echo "You are required to accept the 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 echo "By continuing you are indicating your agreement to the EULA." @@ -25,4 +25,4 @@ echo "" sleep 5 fi -sed -i "s/eula=false/eula=true/g" "${filesdir}/eula.txt" +sed -i "s/eula=false/eula=true/g" "${serverfiles}/eula.txt" diff --git a/lgsm/functions/install_server_dir.sh b/lgsm/functions/install_server_dir.sh index 426e25a2b..523a38465 100644 --- a/lgsm/functions/install_server_dir.sh +++ b/lgsm/functions/install_server_dir.sh @@ -12,7 +12,7 @@ echo "" echo "Server Directory" echo "=================================" sleep 1 -if [ -d "${filesdir}" ]; then +if [ -d "${serverfiles}" ]; then fn_print_warning_nl "A server is already installed here." fi pwd @@ -22,7 +22,7 @@ if [ -z "${autoinstall}" ]; then exit fi fi -if [ ! -d "${filesdir}" ]; then - mkdir -v "${filesdir}" +if [ ! -d "${serverfiles}" ]; then + mkdir -v "${serverfiles}" fi sleep 1 diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index edee16e9f..ed8ad70ff 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -24,11 +24,11 @@ fn_install_server_files(){ 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" 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 - 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 - 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 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 @@ -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" fi 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(){ @@ -62,8 +62,8 @@ fn_install_server_files_steamcmd(){ fi if [ "${counter}" -ge "7" ]; then - echo "Removing $(find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$')" - find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf + echo "Removing $(find ${serverfiles} -type d -print0 | grep -Ez '[^/]{30}$')" + find ${serverfiles} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf fi if [ "${counter}" -ge "9" ]; then rm -rf "${rootdir}/steamcmd" @@ -78,18 +78,18 @@ fn_install_server_files_steamcmd(){ if [ "${counter}" -le "4" ]; 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=$? 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=$? fi elif [ "${counter}" -ge "5" ]; 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=$? 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=$? fi fi @@ -107,7 +107,7 @@ fn_install_server_files_steamcmd(){ counter="0" while [ "${counter}" -le "4" ]; do 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=$? done fi diff --git a/lgsm/functions/install_ts3db.sh b/lgsm/functions/install_ts3db.sh index ebceecfa7..0d363fcb3 100644 --- a/lgsm/functions/install_ts3db.sh +++ b/lgsm/functions/install_ts3db.sh @@ -14,7 +14,7 @@ fn_install_ts3db_mariadb(){ echo "checking if libmariadb2 is installed" echo "=================================" 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 echo "libmariadb2 not installed. Please install it first." echo "exiting..." diff --git a/lgsm/functions/install_unreal_tournament_eula.sh b/lgsm/functions/install_unreal_tournament_eula.sh index b554ab2ad..a8e31b22a 100644 --- a/lgsm/functions/install_unreal_tournament_eula.sh +++ b/lgsm/functions/install_unreal_tournament_eula.sh @@ -11,7 +11,7 @@ sleep 1 echo "You are required to accept the 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 echo "By continuing you are indicating your agreement to the EULA." @@ -25,4 +25,4 @@ echo "" sleep 5 fi -sed -i "s/eula=false/eula=true/g" "${filesdir}/eula.txt" +sed -i "s/eula=false/eula=true/g" "${serverfiles}/eula.txt" diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh index e14ff5932..3d0a73357 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -12,9 +12,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_update_factorio_dl(){ 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}" - echo -e "copying to ${filesdir}...\c" - fn_script_log "Copying to ${filesdir}" - cp -R "${tmpdir}/factorio/"* "${filesdir}" + echo -e "copying to ${serverfiles}...\c" + fn_script_log "Copying to ${serverfiles}" + cp -R "${tmpdir}/factorio/"* "${serverfiles}" local exitcode=$? if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index c54300b78..b28700fef 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -10,9 +10,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_update_dl(){ 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" - fn_script_log "Copying to ${filesdir}" - cp "${tmpdir}/minecraft_server.${availablebuild}.jar" "${filesdir}/minecraft_server.jar" + echo -e "copying to ${serverfiles}...\c" + fn_script_log "Copying to ${serverfiles}" + cp "${tmpdir}/minecraft_server.${availablebuild}.jar" "${serverfiles}/minecraft_server.jar" local exitcode=$? if [ ${exitcode} -eq 0 ]; then fn_print_ok_eol_nl @@ -47,7 +47,7 @@ fn_update_currentbuild(){ fi # 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 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" @@ -58,7 +58,7 @@ fn_update_currentbuild(){ command_stop.sh exitbypass=1 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 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" diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh index 0fcd7936c..9383b73e3 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/functions/update_mta.sh @@ -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" mkdir "${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" - fn_script_log "Copying to ${filesdir}" - cp -R "${tmpdir}/multitheftauto_linux_x64-${fullversion}/multitheftauto_linux_x64-${fullversion}/"* "${filesdir}" + echo -e "copying to ${serverfiles}...\c" + fn_script_log "Copying to ${serverfiles}" + cp -R "${tmpdir}/multitheftauto_linux_x64-${fullversion}/multitheftauto_linux_x64-${fullversion}/"* "${serverfiles}" local exitcode=$? if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh index e90b8276b..b16ea69c4 100644 --- a/lgsm/functions/update_mumble.sh +++ b/lgsm/functions/update_mumble.sh @@ -12,9 +12,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" 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_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" - echo -e "copying to ${filesdir}...\c" - fn_script_log "Copying to ${filesdir}" - cp -R "${tmpdir}/murmur-static_${mumblearch}-${availablebuild}/"* "${filesdir}" + echo -e "copying to ${serverfiles}...\c" + fn_script_log "Copying to ${serverfiles}" + cp -R "${tmpdir}/murmur-static_${mumblearch}-${availablebuild}/"* "${serverfiles}" local exitcode=$? if [ ${exitcode} -eq 0 ]; then fn_print_ok_eol_nl diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index e500a0fbf..26096291f 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -26,17 +26,17 @@ fn_update_steamcmd_dl(){ fi 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 - ${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 fix.sh } fn_appmanifest_info(){ - appmanifestfile=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf") - appmanifestfilewc=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf"|wc -l) + appmanifestfile=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf") + appmanifestfilewc=$(find "${serverfiles}" -type f -name "appmanifest_${appid}.acf"|wc -l) } fn_appmanifest_check(){ diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index f810eb0f4..982d7aecb 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -11,9 +11,9 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" 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_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" - echo -e "copying to ${filesdir}...\c" - fn_script_log "Copying to ${filesdir}" - cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" + echo -e "copying to ${serverfiles}...\c" + fn_script_log "Copying to ${serverfiles}" + cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}" local exitcode=$? if [ "${exitcode}" == "0" ]; then fn_print_ok_eol_nl diff --git a/linuxgsm.sh b/linuxgsm.sh index a76833bbe..9c26ac3c7 100644 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -26,13 +26,13 @@ lgsmdir="${rootdir}/lgsm" functionsdir="${lgsmdir}/functions" libdir="${lgsmdir}/lib" tmpdir="${lgsmdir}/tmp" -filesdir="${rootdir}/serverfiles" +serverfiles="${rootdir}/serverfiles" configdir="${lgsmdir}/config-lgsm" configdirserver="${configdir}/${servername}" configdirdefault="${lgsmdir}/config-default" -## Github Branch Select +## GitHub Branch Select # Allows for the use of different function files # from a different repo and/or branch. githubuser="GameServerManagers" @@ -42,7 +42,7 @@ githubbranch="feature/config" # Core Function that is required first core_functions.sh(){ functionfile="${FUNCNAME}" - fn_bootstrap_fetch_file + fn_bootstrap_fetch_file "lgsm/functions" "core_functions.sh" "${functionsdir}" "_default.cfg" "noexecutecmd" "norun" "noforce" "nomd5" } # Bootstrap @@ -50,16 +50,13 @@ core_functions.sh(){ # Fetches core functions fn_bootstrap_fetch_file(){ - github_file_url_dir="lgsm/functions" # github dir containing the file - github_file_url_name="${functionfile}" # name of the github file - githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" - fileurl="${githuburl}" - filedir="${functionsdir}" - filename="${github_file_url_name}" - executecmd="executecmd" - run="run" - force="noforce" - md5="nomd5" + fileurl="${1}" + filedir="${2}" + filename="${3}" + executecmd="${4:-0}" + run="${5:-0}" + force="${6:-0}" + md5="${7:-0}" # If the file is missing, then download if [ ! -f "${filedir}/${filename}" ]; 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 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 [ ! -f "${serverlist}" ]; then mkdir -p "${datadir}" diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 360345341..ae554e85a 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -93,12 +93,12 @@ tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" ## Server Specific Directories -systemdir="${filesdir}" -executabledir="${filesdir}" +systemdir="${serverfiles}" +executabledir="${serverfiles}" executable="./Jcmp-Server" servercfg="config.lua" servercfgdefault="config.lua" -servercfgdir="${filesdir}" +servercfgdir="${serverfiles}" servercfgfullpath="${servercfgdir}/${servercfg}" ## Backup Directory @@ -443,7 +443,7 @@ echo "Command: ./jc2server update" requiredstatus="OFFLINE" fn_setstatus 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) fn_test_result_pass @@ -456,7 +456,7 @@ echo "Command: ./jc2server update" requiredstatus="ONLINE" fn_setstatus 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) fn_test_result_pass @@ -469,7 +469,7 @@ echo "Command: ./jc2server update" requiredstatus="OFFLINE" fn_setstatus 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) fn_test_result_pass diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index e2bf7b12d..d19223269 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -80,19 +80,19 @@ tmpdir="${lgsmdir}/tmp" filesdir="${rootdir}/serverfiles" ## Server Specific Directories -systemdir="${filesdir}" -executabledir="${filesdir}" +systemdir="${serverfiles}" +executabledir="${serverfiles}" executable="./ts3server_startscript.sh" servercfg="${servicename}.ini" servercfgdefault="ts3server.ini" -servercfgdir="${filesdir}" +servercfgdir="${serverfiles}" servercfgfullpath="${servercfgdir}/${servercfg}" ## Backup Directory backupdir="${rootdir}/backups" ## Logging Directories -gamelogdir="${filesdir}/logs" +gamelogdir="${serverfiles}/logs" scriptlogdir="${rootdir}/log/script" scriptlog="${scriptlogdir}/${servicename}-script.log" emaillog="${scriptlogdir}/${servicename}-email.log"