diff --git a/lgsm/modules/alert_gotify.sh b/lgsm/modules/alert_gotify.sh index faeba4593..ef833ba75 100644 --- a/lgsm/modules/alert_gotify.sh +++ b/lgsm/modules/alert_gotify.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Gotify alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( cat << EOF diff --git a/lgsm/modules/check_permissions.sh b/lgsm/modules/check_permissions.sh index 57beede09..bb3e6764f 100644 --- a/lgsm/modules/check_permissions.sh +++ b/lgsm/modules/check_permissions.sh @@ -52,15 +52,9 @@ fn_check_ownership() { fi } -<<<<<<< HEAD:lgsm/modules/check_permissions.sh -fn_check_permissions(){ +fn_check_permissions() { if [ -d "${modulesdir}" ]; then if [ "$(find "${modulesdir}" -type f -not -executable | wc -l)" -ne "0" ]; then -======= -fn_check_permissions() { - if [ -d "${functionsdir}" ]; then - if [ "$(find "${functionsdir}" -type f -not -executable | wc -l)" -ne "0" ]; then ->>>>>>> develop:lgsm/functions/check_permissions.sh fn_print_fail_nl "Permissions issues found" fn_script_log_fatal "Permissions issues found" fn_print_information_nl "The following files are not executable:" @@ -229,15 +223,8 @@ fn_sys_perm_error_process() { fi } -<<<<<<< HEAD:lgsm/modules/check_permissions.sh -# Run perm error detect & fix/alert modules on /sys directories. - -## Run checks. -if [ "$(whoami)" != "root" ]; then -======= ## Run permisions checks when not root or docker. if [ "$(whoami)" != "root" ] && [ ! -f /.dockerenv ]; then ->>>>>>> develop:lgsm/functions/check_permissions.sh fn_check_ownership fn_check_permissions if [ "${commandname}" == "START" ]; then diff --git a/lgsm/modules/command_monitor.sh b/lgsm/modules/command_monitor.sh index 1b764c612..f2db9ca2d 100644 --- a/lgsm/modules/command_monitor.sh +++ b/lgsm/modules/command_monitor.sh @@ -26,9 +26,9 @@ fn_monitor_check_lockfile() { # Fix if lockfile is not unix time or contains letters if [ -f "${lockdir}/${selfname}.lock" ] && [[ "$(head -n 1 "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then - date '+%s' >"${lockdir}/${selfname}.lock" - echo "${version}" >>"${lockdir}/${selfname}.lock" - echo "${port}" >>"${lockdir}/${selfname}.lock" + date '+%s' > "${lockdir}/${selfname}.lock" + echo "${version}" >> "${lockdir}/${selfname}.lock" + echo "${port}" >> "${lockdir}/${selfname}.lock" fi } @@ -87,12 +87,12 @@ fn_query_gsquery() { if [ ! -f "${modulesdir}/query_gsquery.py" ]; then fn_fetch_file_github "lgsm/modules" "query_gsquery.py" "${modulesdir}" "chmodx" "norun" "noforce" "nohash" fi - "${modulesdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}" >/dev/null 2>&1 + "${modulesdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}" > /dev/null 2>&1 querystatus="$?" } fn_query_tcp() { - bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}'' >/dev/null 2>&1 + bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}'' > /dev/null 2>&1 querystatus="$?" } @@ -205,7 +205,7 @@ fn_monitor_loop() { for querymethod in "${query_methods_array[@]}"; do # Will check if gamedig is installed and bypass if not. if [ "${querymethod}" == "gamedig" ]; then - if [ "$(command -v gamedig 2>/dev/null)" ] && [ "$(command -v jq 2>/dev/null)" ]; then + if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then if [ -z "${monitorpass}" ]; then fn_monitor_query fi diff --git a/lgsm/modules/command_start.sh b/lgsm/modules/command_start.sh index caecaa828..e5021cde2 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -7,12 +7,8 @@ commandname="START" commandaction="Starting" -<<<<<<< HEAD:lgsm/modules/command_start.sh moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -======= -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" addtimestamp="gawk '{ print strftime(\\\"[$logtimestampformat]\\\"), \\\$0 }'" ->>>>>>> develop:lgsm/functions/command_start.sh fn_firstcommand_set fn_start_teamspeak3() { diff --git a/lgsm/modules/command_update_linuxgsm.sh b/lgsm/modules/command_update_linuxgsm.sh index 407bb3826..3c4e6d080 100644 --- a/lgsm/modules/command_update_linuxgsm.sh +++ b/lgsm/modules/command_update_linuxgsm.sh @@ -180,95 +180,50 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then fi fi # Check and update modules. -<<<<<<< HEAD:lgsm/modules/command_update_linuxgsm.sh if [ -n "${modulesdir}" ]; then if [ -d "${modulesdir}" ]; then - cd "${modulesdir}" || exit - for modulefile in *; do - # check if module exists in the repo and remove if missing. - # commonly used if module names change. - echo -en "checking ${remotereponame} module ${modulefile}...\c" - github_fileurl_dir="lgsm/modules" - if [ "${remotereponame}" == "GitHub" ]; then - curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${modulefile}" 1>/dev/null - else - curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${modulefile}" 1>/dev/null - fi - if [ $? != 0 ]; then - fn_print_error_eol_nl - fn_script_log_error "Checking ${remotereponame} module ${modulefile}" - echo -en "removing module ${modulefile}...\c" - if ! rm -f "${modulefile:?}"; then - fn_print_fail_eol_nl - fn_script_log_fatal "Removing module ${modulefile}" - core_exit.sh - else - fn_print_ok_eol_nl - fn_script_log_pass "Removing module ${modulefile}" - fi - else - # compare file - if [ "${remotereponame}" == "GitHub" ]; then - module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl --connect-timeout 10 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${modulefile}")) - else - module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl --connect-timeout 10 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${modulefile}")) - fi - - # results - if [ "${module_file_diff}" != "" ]; then - fn_print_update_eol_nl - fn_script_log_update "Checking ${remotereponame} module ${modulefile}" - rm -rf "${modulesdir:?}/${modulefile}" - fn_update_module - else - fn_print_ok_eol_nl - fn_script_log_pass "Checking ${remotereponame} module ${modulefile}" -======= -if [ -n "${functionsdir}" ]; then - if [ -d "${functionsdir}" ]; then ( - cd "${functionsdir}" || exit - for functionfile in *; do + cd "${modulesdir}" || exit + for modulefile in *; do # check if module exists in the repo and remove if missing. # commonly used if module names change. - echo -en "checking ${remotereponame} module ${functionfile}...\c" - github_file_url_dir="lgsm/functions" + echo -en "checking ${remotereponame} module ${modulefile}...\c" + github_file_url_dir="lgsm/modules" if [ "${remotereponame}" == "GitHub" ]; then - curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" 1> /dev/null + curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null else - curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}" 1> /dev/null + curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null fi if [ $? != 0 ]; then fn_print_error_eol_nl - fn_script_log_error "Checking ${remotereponame} module ${functionfile}" - echo -en "removing module ${functionfile}...\c" - if ! rm -f "${functionfile:?}"; then + fn_script_log_error "Checking ${remotereponame} module ${modulefile}" + echo -en "removing module ${modulefile}...\c" + if ! rm -f "${modulefile:?}"; then fn_print_fail_eol_nl - fn_script_log_fatal "Removing module ${functionfile}" + fn_script_log_fatal "Removing module ${modulefile}" core_exit.sh else fn_print_ok_eol_nl - fn_script_log_pass "Removing module ${functionfile}" + fn_script_log_pass "Removing module ${modulefile}" fi else # compare file if [ "${remotereponame}" == "GitHub" ]; then - function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl --connect-timeout 10 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}")) + module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl --connect-timeout 10 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}")) else - function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl --connect-timeout 10 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${functionfile}")) + module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl --connect-timeout 10 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}")) fi # results - if [ "${function_file_diff}" != "" ]; then + if [ "${module_file_diff}" != "" ]; then fn_print_update_eol_nl - fn_script_log_update "Checking ${remotereponame} module ${functionfile}" - rm -rf "${functionsdir:?}/${functionfile}" - fn_update_function + fn_script_log_update "Checking ${remotereponame} module ${modulefile}" + rm -rf "${modulesdir:?}/${modulefile}" + fn_update_module else fn_print_ok_eol_nl - fn_script_log_pass "Checking ${remotereponame} module ${functionfile}" + fn_script_log_pass "Checking ${remotereponame} module ${modulefile}" fi ->>>>>>> develop:lgsm/functions/command_update_linuxgsm.sh fi done ) diff --git a/lgsm/modules/core_dl.sh b/lgsm/modules/core_dl.sh index b1fbd237c..405e9dc6b 100644 --- a/lgsm/modules/core_dl.sh +++ b/lgsm/modules/core_dl.sh @@ -456,10 +456,10 @@ fn_fetch_file() { # GitHub file download modules. # Used to simplify downloading specific files from GitHub. -# github_fileurl_dir: the directory of the file in the GitHub: lgsm/modules -# github_fileurl_name: the filename of the file to download from GitHub: core_messages.sh -# github_fileurl_dir: the directory of the file in the GitHub: lgsm/modules -# github_fileurl_name: the filename of the file to download from GitHub: core_messages.sh +# github_file_url_dir: the directory of the file in the GitHub: lgsm/modules +# github_file_url_name: the filename of the file to download from GitHub: core_messages.sh +# github_file_url_dir: the directory of the file in the GitHub: lgsm/modules +# github_file_url_name: the filename of the file to download from GitHub: core_messages.sh # githuburl: the full GitHub url # remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2 @@ -472,24 +472,24 @@ fn_fetch_file() { # Fetches files from the Git repo. fn_fetch_file_github() { - github_fileurl_dir="${1}" - github_fileurl_name="${2}" + github_file_url_dir="${1}" + github_file_url_name="${2}" # For legacy versions - code can be removed at a future date if [ "${legacymode}" == "1" ]; then - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. elif [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" - local_filename="${github_fileurl_name}" + local_filename="${github_file_url_name}" chmodx="${4:-0}" run="${5:-0}" forcedl="${6:-0}" @@ -499,31 +499,31 @@ fn_fetch_file_github() { } fn_check_file_github() { - github_fileurl_dir="${1}" - github_fileurl_name="${2}" + github_file_url_dir="${1}" + github_file_url_name="${2}" if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" - fn_check_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${github_fileurl_name}" + fn_check_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${github_file_url_name}" } # Fetches config files from the Git repo. fn_fetch_config() { - github_fileurl_dir="${1}" - github_fileurl_name="${2}" + github_file_url_dir="${1}" + github_file_url_name="${2}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" @@ -538,29 +538,21 @@ fn_fetch_config() { } # Fetches modules from the Git repo during first download. -<<<<<<< HEAD:lgsm/modules/core_dl.sh -fn_fetch_module(){ - github_fileurl_dir="lgsm/modules" - github_fileurl_name="${modulefile}" - # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. - if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then -======= -fn_fetch_function() { - github_fileurl_dir="lgsm/functions" - github_fileurl_name="${functionfile}" +fn_fetch_module() { + github_file_url_dir="lgsm/modules" + github_file_url_name="${modulefile}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then ->>>>>>> develop:lgsm/functions/core_dl.sh - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" local_filedir="${modulesdir}" - local_filename="${github_fileurl_name}" + local_filename="${github_file_url_name}" chmodx="chmodx" run="run" forcedl="noforce" @@ -570,27 +562,21 @@ fn_fetch_function() { } # Fetches modules from the Git repo during update-lgsm. -<<<<<<< HEAD:lgsm/modules/core_dl.sh -fn_update_module(){ - github_fileurl_dir="lgsm/modules" - github_fileurl_name="${modulefile}" -======= -fn_update_function() { - github_fileurl_dir="lgsm/functions" - github_fileurl_name="${functionfile}" ->>>>>>> develop:lgsm/functions/core_dl.sh +fn_update_module() { + github_file_url_dir="lgsm/modules" + github_file_url_name="${modulefile}" # If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" local_filedir="${modulesdir}" - local_filename="${github_fileurl_name}" + local_filename="${github_file_url_name}" chmodx="chmodx" run="norun" forcedl="noforce" diff --git a/lgsm/modules/core_functions.sh b/lgsm/modules/core_functions.sh index a1708008c..07a2ebd09 100755 --- a/lgsm/modules/core_functions.sh +++ b/lgsm/modules/core_functions.sh @@ -6,7 +6,7 @@ # Description: Defines all functions to allow download and execution of functions using fn_fetch_function. # This function is called first before any other function. Without this file other functions will not load. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" modulesversion="v23.2.0" diff --git a/lgsm/modules/core_getopt.sh b/lgsm/modules/core_getopt.sh index bf1d57570..222ad0cf8 100644 --- a/lgsm/modules/core_getopt.sh +++ b/lgsm/modules/core_getopt.sh @@ -10,22 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Define all commands here. ## User commands | Trigger commands | Description # Standard commands. -<<<<<<< HEAD:lgsm/modules/core_getopt.sh -cmd_install=( "i;install" "command_install.sh" "Install the server." ) -cmd_auto_install=( "ai;auto-install" "fn_autoinstall" "Install the server without prompts." ) -cmd_start=( "st;start" "command_start.sh" "Start the server." ) -cmd_stop=( "sp;stop" "command_stop.sh" "Stop the server." ) -cmd_restart=( "r;restart" "command_restart.sh" "Restart the server." ) -cmd_details=( "dt;details" "command_details.sh" "Display server information." ) -cmd_postdetails=( "pd;postdetails" "command_postdetails.sh" "Post details to termbin.com (removing passwords)." ) -cmd_backup=( "b;backup" "command_backup.sh" "Create backup archives of the server." ) -cmd_update_linuxgsm=( "ul;update-lgsm;uf;update-modules" "command_update_linuxgsm.sh" "Check and apply any LinuxGSM updates." ) -cmd_test_alert=( "ta;test-alert" "command_test_alert.sh" "Send a test alert." ) -cmd_monitor=( "m;monitor" "command_monitor.sh" "Check server status and restart if crashed." ) -cmd_skeleton=( "sk;skeleton" "command_skeleton.sh" "Create a skeleton directory." ) -cmd_sponsor=( "do;sponsor" "command_sponsor.sh" "Donation options." ) -cmd_send=( "sd;send" "command_send.sh" "Send command to game server console." ) -======= cmd_install=("i;install" "command_install.sh" "Install the server.") cmd_auto_install=("ai;auto-install" "fn_autoinstall" "Install the server without prompts.") cmd_start=("st;start" "command_start.sh" "Start the server.") @@ -34,13 +18,12 @@ cmd_restart=("r;restart" "command_restart.sh" "Restart the server.") cmd_details=("dt;details" "command_details.sh" "Display server information.") cmd_postdetails=("pd;postdetails" "command_postdetails.sh" "Post details to termbin.com (removing passwords).") cmd_backup=("b;backup" "command_backup.sh" "Create backup archives of the server.") -cmd_update_linuxgsm=("ul;update-lgsm;uf;update-functions" "command_update_linuxgsm.sh" "Check and apply any LinuxGSM updates.") +cmd_update_linuxgsm=("ul;update-lgsm;uf;update-modules" "command_update_linuxgsm.sh" "Check and apply any LinuxGSM updates.") cmd_test_alert=("ta;test-alert" "command_test_alert.sh" "Send a test alert.") cmd_monitor=("m;monitor" "command_monitor.sh" "Check server status and restart if crashed.") cmd_skeleton=("sk;skeleton" "command_skeleton.sh" "Create a skeleton directory.") -cmd_sponsor=("s;sponsor" "command_sponsor.sh" "Donation options.") +cmd_sponso=("s;sponsor" "command_sponsor.sh" "Donation options.") cmd_send=("sd;send" "command_send.sh" "Send command to game server console.") ->>>>>>> develop:lgsm/functions/core_getopt.sh # Console servers only. cmd_console=("c;console" "command_console.sh" "Access server console.") cmd_debug=("d;debug" "command_debug.sh" "Start server directly in your terminal.") @@ -66,22 +49,12 @@ cmd_install_dst_token=("ct;cluster-token" "install_dst_token.sh" "Configure clus cmd_install_squad_license=("li;license" "install_squad_license.sh" "Add your Squad server license.") cmd_fastdl=("fd;fastdl" "command_fastdl.sh" "Build a FastDL directory.") # Dev commands. -<<<<<<< HEAD:lgsm/modules/core_getopt.sh -cmd_dev_debug=( "dev;developer" "command_dev_debug.sh" "Enable developer Mode." ) -cmd_dev_detect_deps=( "dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies." ) -cmd_dev_detect_glibc=( "dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc." ) -cmd_dev_detect_ldd=( "dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies." ) -cmd_dev_query_raw=( "qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery." ) -cmd_dev_clear_modules=( "cf;clear-modules" "command_dev_clear_modules.sh" "Delete the contents of the modules dir." ) - -======= cmd_dev_debug=("dev;developer" "command_dev_debug.sh" "Enable developer Mode.") cmd_dev_detect_deps=("dd;detect-deps" "command_dev_detect_deps.sh" "Detect required dependencies.") cmd_dev_detect_glibc=("dg;detect-glibc" "command_dev_detect_glibc.sh" "Detect required glibc.") cmd_dev_detect_ldd=("dl;detect-ldd" "command_dev_detect_ldd.sh" "Detect required dynamic dependencies.") cmd_dev_query_raw=("qr;query-raw" "command_dev_query_raw.sh" "The raw output of gamedig and gsquery.") -cmd_dev_clear_functions=("cf;clear-functions" "command_dev_clear_functions.sh" "Delete the contents of the functions dir.") ->>>>>>> develop:lgsm/functions/core_getopt.sh +cmd_dev_clear_modules=("cf;clear-modules" "command_dev_clear_modules.sh" "Delete the contents of the modules dir.") ### Set specific opt here. @@ -172,19 +145,11 @@ currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}") ## Developer commands. currentopt+=("${cmd_dev_debug[@]}") if [ -f ".dev-debug" ]; then -<<<<<<< HEAD:lgsm/modules/core_getopt.sh - currentopt+=( "${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_modules[@]}" ) -fi - -## Donate. -currentopt+=( "${cmd_sponsor[@]}" ) -======= - currentopt+=("${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}") + currentopt+=("${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_modules[@]}") fi ## Sponsor. currentopt+=("${cmd_sponsor[@]}") ->>>>>>> develop:lgsm/functions/core_getopt.sh ### Build list of available commands. optcommands=() diff --git a/lgsm/modules/core_legacy.sh b/lgsm/modules/core_legacy.sh index 41de99f9d..2ed942abd 100644 --- a/lgsm/modules/core_legacy.sh +++ b/lgsm/modules/core_legacy.sh @@ -78,7 +78,6 @@ if [ -z "${wsstartmap}" ]; then fi fi -<<<<<<< HEAD:lgsm/modules/core_legacy.sh # Added as part of migrating functions dir to modules dir. # Will remove functions dir if files in modules dir older than 14 days functionsdir="${lgsmdir}/modules" @@ -87,10 +86,8 @@ if [ -d "${lgsmdir}/functions" ]; then rm -rf "${lgsmdir:?}/functions" fi fi -fn_parms(){ -======= + fn_parms() { ->>>>>>> develop:lgsm/functions/core_legacy.sh fn_reload_startparameters parms="${startparameters}" } diff --git a/lgsm/modules/core_modules.sh b/lgsm/modules/core_modules.sh index 955687a09..8eb843b5a 100644 --- a/lgsm/modules/core_modules.sh +++ b/lgsm/modules/core_modules.sh @@ -8,779 +8,789 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v21.2.5" +modulesversion="v23.2.0" # Core -core_dl.sh(){ -modulefile="${FUNCNAME[0]}" -if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then - fn_fetch_core_dl "lgsm/modules" "core_dl.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" -else - fn_bootstrap_fetch_file_github "lgsm/modules" "core_dl.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" -fi +core_dl.sh() { + modulefile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/modules" "core_dl.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/modules" "core_dl.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" + fi } -core_messages.sh(){ -modulefile="${FUNCNAME[0]}" -if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then - fn_fetch_core_dl "lgsm/modules" "core_messages.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" -else - fn_bootstrap_fetch_file_github "lgsm/modules" "core_messages.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" -fi +core_messages.sh() { + modulefile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/modules" "core_messages.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/modules" "core_messages.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" + fi } -core_legacy.sh(){ -modulefile="${FUNCNAME[0]}" -if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then - fn_fetch_core_dl "lgsm/modules" "core_legacy.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" -else - fn_bootstrap_fetch_file_github "lgsm/modules" "core_legacy.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" -fi +core_legacy.sh() { + modulefile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/modules" "core_legacy.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/modules" "core_legacy.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" + fi } -core_exit.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +core_exit.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -core_getopt.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +core_getopt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -core_trap.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +core_trap.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -core_steamcmd.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +core_steamcmd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -core_github.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +core_github.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Commands -command_backup.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_backup.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_console.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_console.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_debug.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_debug.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_details.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_details.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_sponsor.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_sponsor.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_postdetails.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_postdetails.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_test_alert.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_test_alert.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_monitor.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_monitor.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_start.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_start.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_stop.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_stop.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_validate.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_validate.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_install.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_install.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_install_resources_mta.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_install_resources_mta.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_squad_license.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_squad_license.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_mods_install.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_mods_install.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_mods_update.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_mods_update.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_mods_remove.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_mods_remove.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_fastdl.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_fastdl.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_ts3_server_pass.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_ts3_server_pass.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_restart.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_restart.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_skeleton.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_skeleton.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_wipe.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_wipe.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_send.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_send.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Checks -check.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_config.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_config.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_deps.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_deps.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_executable.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_executable.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_glibc.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_glibc.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_ip.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_ip.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_last_update.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_last_update.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_logs.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_logs.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_permissions.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_permissions.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_root.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_root.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_status.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_status.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_steamcmd.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_steamcmd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_system_dir.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_system_dir.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_system_requirements.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_system_requirements.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_tmuxception.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_tmuxception.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -check_version.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +check_version.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Compress -compress_unreal2_maps.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +compress_unreal2_maps.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -compress_ut99_maps.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +compress_ut99_maps.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Mods -mods_list.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +mods_list.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -mods_core.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +mods_core.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Dev -command_dev_clear_modules.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_dev_clear_modules.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_dev_debug.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_dev_debug.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_dev_detect_deps.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_dev_detect_deps.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_dev_detect_glibc.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_dev_detect_glibc.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_dev_detect_ldd.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_dev_detect_ldd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_dev_query_raw.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_dev_query_raw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Fix -fix.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_ark.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_ark.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_av.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_av.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_arma3.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_arma3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_bo.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_armar.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_cmw.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_bt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_csgo.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_bo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_dst.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_cmw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_hw.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_csgo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_ins.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_dst.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_kf.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_hw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_kf2.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_ins.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_lo.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_kf.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_mcb.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_kf2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_mta.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_lo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_nmrih.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_mcb.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_onset.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_mta.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_ro.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_nmrih.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_rust.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_onset.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_rw.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_ro.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_sfc.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_rust.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_st.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_rw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_steamcmd.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_sfc.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_terraria.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_st.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_tf2.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_steamcmd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_ut3.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_terraria.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_rust.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_tf2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_samp.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_ut3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_sdtd.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_rust.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_sof2.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_samp.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_squad.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_sdtd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_ts3.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_sof2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_ut2k4.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_squad.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_ut.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_ts3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_unt.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_ut2k4.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_vh.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_ut.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_wurm.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_unt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fix_zmr.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_vh.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -# Info +fix_wurm.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} -info_distro.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fix_zmr.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -info_game.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +# Info + +info_distro.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -info_gamedig.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +info_game.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -info_messages.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +info_messages.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -info_stats.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +info_stats.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Alert -alert.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +alert_discord.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_discord.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_email.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_email.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_ifttt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_ifttt.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_mailgun.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_mailgun.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_pushbullet.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_pushbullet.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_pushover.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_pushover.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_gotify.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_telegram.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_telegram.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_rocketchat.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_rocketchat.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -alert_slack.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +alert_slack.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Logs -core_logs.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +core_logs.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Query -query_gamedig.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +query_gamedig.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Update -command_update_modules.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_update_modules.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_update_linuxgsm.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_update_linuxgsm.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_update.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_update.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -command_check_update.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +command_check_update.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_ts3.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_ts3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_minecraft.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_minecraft.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_minecraft_bedrock.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_minecraft_bedrock.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_papermc.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_papermc.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_mumble.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_mta.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_mta.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_factorio.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_factorio.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_jediknight2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_jediknight2.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_steamcmd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_steamcmd.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_vintagestory.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -update_vintagestory.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +update_ut99.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -fn_update_modules.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +fn_update_modules.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # ## Installer modules # -fn_autoinstall(){ -autoinstall=1 -command_install.sh +fn_autoinstall() { + autoinstall=1 + command_install.sh } -install_complete.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_complete.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_config.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_config.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_factorio_save.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_factorio_save.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_dst_token.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_dst_token.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_eula.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_eula.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_gsquery.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_gsquery.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_gslt.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_gslt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_header.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_header.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_logs.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_logs.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_retry.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_retry.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_server_dir.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_server_dir.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_server_files.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_server_files.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_stats.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_stats.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_steamcmd.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_steamcmd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_ts3.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_ts3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_ts3db.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_ts3db.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_ut2k4.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_ut2k4.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_dl_ut2k4.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_dl_ut2k4.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } -install_ut2k4_key.sh(){ -modulefile="${FUNCNAME[0]}" -fn_fetch_module +install_ut2k4_key.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module } # Calls code required for legacy servers diff --git a/lgsm/modules/fix.sh b/lgsm/modules/fix.sh index 082117e07..322091f5a 100644 --- a/lgsm/modules/fix.sh +++ b/lgsm/modules/fix.sh @@ -59,7 +59,7 @@ apply_post_install_fix=(av kf kf2 lo ro samp ut2k4 ut ut3) for fix in "${apply_pre_start_fix[@]}" "${apply_post_install_fix[@]}"; do if ! fn_exists_fix "${fix}"; then fn_print_fail_nl "fix_${fix}.sh is registered but doesn't exist. Typo or did you miss to modify core_functions.sh?" - exitcode 1 + exitcode=1 core_exit.sh fi done diff --git a/lgsm/modules/fix_armar.sh b/lgsm/modules/fix_armar.sh index 9db42f51a..2a56daf41 100755 --- a/lgsm/modules/fix_armar.sh +++ b/lgsm/modules/fix_armar.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves an issue with Arma Reforger. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: Profile directory doesn't exist. # Issue Link: https://feedback.bistudio.com/T164845 diff --git a/lgsm/modules/fix_bt.sh b/lgsm/modules/fix_bt.sh index 07fd61ce5..bb26155d8 100755 --- a/lgsm/modules/fix_bt.sh +++ b/lgsm/modules/fix_bt.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves an issue with Barotrauma. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: Missing user data directory error. if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma" ]; then diff --git a/lgsm/modules/query_gamedig.sh b/lgsm/modules/query_gamedig.sh index 622f6ac2b..bbf24f5d7 100644 --- a/lgsm/modules/query_gamedig.sh +++ b/lgsm/modules/query_gamedig.sh @@ -6,13 +6,8 @@ # Description: Querys a gameserver using node-gamedig. # https://github.com/sonicsnes/node-gamedig -<<<<<<< HEAD:lgsm/modules/query_gamedig.sh moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" - -======= -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" querystatus="2" ->>>>>>> develop:lgsm/functions/query_gamedig.sh # Check if gamedig and jq are installed. if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then diff --git a/lgsm/modules/update_mumble.sh b/lgsm/modules/update_mumble.sh deleted file mode 100644 index b6a1cf4d9..000000000 --- a/lgsm/modules/update_mumble.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash -# LinuxGSM update_mumble.sh module -# Author: Daniel Gibbs -# Contributors: http://linuxgsm.com/contrib -# Website: https://linuxgsm.com -# Description: Handles updating of Mumble servers. - -moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" - -fn_update_mumble_dl(){ - fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${remotebuild}/murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "" "" "" "${tmpdir}" "murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "" "norun" "noforce" "nohash" - fn_dl_extract "${tmpdir}" "murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "${tmpdir}" - echo -e "copying to ${serverfiles}...\c" - cp -R "${tmpdir}/murmur-static_${mumblearch}-${remotebuild}/"* "${serverfiles}" - local exitcode=$? - if [ "${exitcode}" == "0" ]; then - fn_print_ok_eol_nl - fn_script_log_pass "Copying to ${serverfiles}" - fn_clear_tmp - else - fn_print_fail_eol_nl - fn_script_log_fatal "Copying to ${serverfiles}" - fn_clear_tmp - core_exit.sh - fi -} - -fn_update_mumble_localbuild(){ - # Gets local build info. - fn_print_dots "Checking local build: ${remotelocation}" - # Uses executable to find local build. - cd "${executabledir}" || exit - if [ -f "${executable}" ]; then - localbuild=$(${executable} -version 2>&1 >/dev/null | awk '{print $5}') - fn_print_ok "Checking local build: ${remotelocation}" - fn_script_log_pass "Checking local build" - else - localbuild="0" - fn_print_error "Checking local build: ${remotelocation}" - fn_script_log_error "Checking local build" - fi -} - -fn_update_mumble_remotebuild(){ - # Gets remote build info. - remotebuild=$(curl -s "https://api.github.com/repos/mumble-voip/mumble/releases/latest" | grep 'murmur-static_x86.*\.bz2"' | tail -1 | awk -F"/" '{ print $8 }') - if [ "${firstcommandname}" != "INSTALL" ]; then - fn_print_dots "Checking remote build: ${remotelocation}" - # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking remote build: ${remotelocation}" - fn_script_log_fatal "Checking remote build" - core_exit.sh - else - fn_print_ok "Checking remote build: ${remotelocation}" - fn_script_log_pass "Checking remote build" - fi - else - # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_failure "Unable to get remote build" - fn_script_log_fatal "Unable to get remote build" - core_exit.sh - fi - fi -} - -fn_update_mumble_compare(){ - # Removes dots so if statement can compare version numbers. - fn_print_dots "Checking for update: ${remotelocation}" - localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') - remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]') - if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ]||[ "${forceupdate}" == "1" ]; then - fn_print_ok_nl "Checking for update: ${remotelocation}" - echo -en "\n" - echo -e "Update available" - echo -e "* Local build: ${red}${localbuild} ${mumblearch}${default}" - echo -e "* Remote build: ${green}${remotebuild} ${mumblearch}${default}" - echo -en "\n" - fn_script_log_info "Update available" - fn_script_log_info "Local build: ${localbuild} ${mumblearch}" - fn_script_log_info "Remote build: ${remotebuild} ${mumblearch}" - fn_script_log_info "${localbuild} > ${remotebuild}" - - unset updateonstart - check_status.sh - # If server stopped. - if [ "${status}" == "0" ]; then - exitbypass=1 - fn_update_mumble_dl - if [ "${requirerestart}" == "1" ]; then - exitbypass=1 - command_start.sh - fn_firstcommand_reset - exitbypass=1 - command_stop.sh - fn_firstcommand_reset - fi - # If server started. - else - fn_print_restart_warning - exitbypass=1 - command_stop.sh - fn_firstcommand_reset - exitbypass=1 - fn_update_mumble_dl - exitbypass=1 - command_start.sh - fn_firstcommand_reset - fi - unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" - alert="update" - alert.sh - else - fn_print_ok_nl "Checking for update: ${remotelocation}" - echo -en "\n" - echo -e "No update available" - echo -e "* Local build: ${green}${localbuild} ${mumblearch}${default}" - echo -e "* Remote build: ${green}${remotebuild} ${mumblearch}${default}" - echo -en "\n" - fn_script_log_info "No update available" - fn_script_log_info "Local build: ${localbuild} ${mumblearch}" - fn_script_log_info "Remote build: ${remotebuild} ${mumblearch}" - fi -} - -# The location where the builds are checked and downloaded. -remotelocation="mumble.info" - -# Game server architecture. -mumblearch="x86" - -if [ "${firstcommandname}" == "INSTALL" ]; then - fn_update_mumble_remotebuild - fn_update_mumble_dl -else - fn_print_dots "Checking for update: ${remotelocation}" - fn_script_log_info "Checking for update: ${remotelocation}" - fn_update_mumble_localbuild - fn_update_mumble_remotebuild - fn_update_mumble_compare -fi diff --git a/lgsm/modules/update_papermc.sh b/lgsm/modules/update_papermc.sh index a52f6d362..447f8808a 100644 --- a/lgsm/modules/update_papermc.sh +++ b/lgsm/modules/update_papermc.sh @@ -5,13 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of PaperMC and Waterfall servers. -<<<<<<< HEAD:lgsm/modules/update_papermc.sh -local commandname="UPDATE" -local commandaction="Update" -local module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -======= -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ->>>>>>> develop:lgsm/functions/update_papermc.sh +module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles diff --git a/lgsm/modules/update_steamcmd.sh b/lgsm/modules/update_steamcmd.sh index 91191ff22..401da43a8 100644 --- a/lgsm/modules/update_steamcmd.sh +++ b/lgsm/modules/update_steamcmd.sh @@ -18,7 +18,7 @@ fn_print_dots "${remotelocation}" if [ "${forceupdate}" == "1" ]; then # forceupdate bypasses update checks. - if [ "${status}" != "0" ]&&[ -v "${status}" ]; then + if [ "${status}" != "0" ] && [ -v "${status}" ]; then fn_print_restart_warning exitbypass=1 command_stop.sh diff --git a/lgsm/modules/update_ut99.sh b/lgsm/modules/update_ut99.sh index b6db783e2..a1dc2b3dd 100644 --- a/lgsm/modules/update_ut99.sh +++ b/lgsm/modules/update_ut99.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Unreal Tournament 99 servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles diff --git a/linuxgsm.sh b/linuxgsm.sh index f80cf3b03..dd7d51bb3 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -51,15 +51,21 @@ userinput2="${2}" [ -n "${LGSM_GITHUBREPO}" ] && githubrepo="${LGSM_GITHUBREPO}" || githubrepo="LinuxGSM" [ -n "${LGSM_GITHUBBRANCH}" ] && githubbranch="${LGSM_GITHUBBRANCH}" || githubbranch="master" +# Check that curl is installed before doing anything +if [ ! "$(command -v curl 2> /dev/null)" ]; then + echo -e "[ FAIL ] Curl is not installed" + exit 1 +fi + # Core module that is required first. -core_modules.sh(){ +core_modules.sh() { modulefile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nomd5" } # Bootstrap # Fetches the core modules required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -166,13 +172,13 @@ fn_bootstrap_fetch_file_github() { remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" - local_filename="${github_fileurl_name}" + local_filename="${github_file_url_name}" chmodx="${4:-0}" run="${5:-0}" forcedl="${6:-0}" @@ -321,7 +327,7 @@ if [ "$(whoami)" == "root" ] && [ ! -f /.dockerenv ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${modulesdir}/core_modules.sh" ]||[ ! -f "${modulesdir}/check_root.sh" ]||[ ! -f "${modulesdir}/core_messages.sh" ]; then + elif [ ! -f "${modulesdir}/core_modules.sh" ] || [ ! -f "${modulesdir}/check_root.sh" ] || [ ! -f "${modulesdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index 2c94a1f2b..97981c0cc 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -58,14 +58,14 @@ githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" # Core module that is required first. -core_modules.sh(){ +core_modules.sh() { modulefile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" } # Bootstrap # Fetches the core modules required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -172,13 +172,13 @@ fn_bootstrap_fetch_file_github() { remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" - local_filename="${github_fileurl_name}" + local_filename="${github_file_url_name}" chmodx="${4:-0}" run="${5:-0}" forcedl="${6:-0}" @@ -327,7 +327,7 @@ if [ "$(whoami)" == "root" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${modulesdir}/core_modules.sh" ]||[ ! -f "${modulesdir}/check_root.sh" ]||[ ! -f "${modulesdir}/core_messages.sh" ]; then + elif [ ! -f "${modulesdir}/core_modules.sh" ] || [ ! -f "${modulesdir}/check_root.sh" ] || [ ! -f "${modulesdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 566123bf1..57dd28cc8 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -59,14 +59,14 @@ githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" # Core module that is required first. -core_modules.sh(){ +core_modules.sh() { modulefile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" } # Bootstrap # Fetches the core modules required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -173,13 +173,13 @@ fn_bootstrap_fetch_file_github() { remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" - local_filename="${github_fileurl_name}" + local_filename="${github_file_url_name}" chmodx="${4:-0}" run="${5:-0}" forcedl="${6:-0}" @@ -328,7 +328,7 @@ if [ "$(whoami)" == "root" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${modulesdir}/core_modules.sh" ]||[ ! -f "${modulesdir}/check_root.sh" ]||[ ! -f "${modulesdir}/core_messages.sh" ]; then + elif [ ! -f "${modulesdir}/core_modules.sh" ] || [ ! -f "${modulesdir}/check_root.sh" ] || [ ! -f "${modulesdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index d2d33fb74..a32ffd8f5 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -59,14 +59,14 @@ githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" # Core module that is required first. -core_modules.sh(){ +core_modules.sh() { modulefile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" } # Bootstrap # Fetches the core modules required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -173,13 +173,13 @@ fn_bootstrap_fetch_file_github() { remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" - local_filename="${github_fileurl_name}" + local_filename="${github_file_url_name}" chmodx="${4:-0}" run="${5:-0}" forcedl="${6:-0}" @@ -328,7 +328,7 @@ if [ "$(whoami)" == "root" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${modulesdir}/core_modules.sh" ]||[ ! -f "${modulesdir}/check_root.sh" ]||[ ! -f "${modulesdir}/core_messages.sh" ]; then + elif [ ! -f "${modulesdir}/core_modules.sh" ] || [ ! -f "${modulesdir}/check_root.sh" ] || [ ! -f "${modulesdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index 2f71c9078..7d7ed7180 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -59,14 +59,14 @@ githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" # Core module that is required first. -core_modules.sh(){ +core_modules.sh() { modulefile="${FUNCNAME[0]}" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" } # Bootstrap # Fetches the core modules required before passed off to core_dl.sh. -fn_bootstrap_fetch_file(){ +fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" remote_fileurl_name="${3}" @@ -173,13 +173,13 @@ fn_bootstrap_fetch_file_github() { remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else - remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" - remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}" + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" fi remote_fileurl_name="GitHub" remote_fileurl_backup_name="Bitbucket" local_filedir="${3}" - local_filename="${github_fileurl_name}" + local_filename="${github_file_url_name}" chmodx="${4:-0}" run="${5:-0}" forcedl="${6:-0}" @@ -328,7 +328,7 @@ if [ "$(whoami)" == "root" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${modulesdir}/core_modules.sh" ]||[ ! -f "${modulesdir}/check_root.sh" ]||[ ! -f "${modulesdir}/core_messages.sh" ]; then + elif [ ! -f "${modulesdir}/core_modules.sh" ] || [ ! -f "${modulesdir}/check_root.sh" ] || [ ! -f "${modulesdir}/core_messages.sh" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 else