Browse Source

fix merge bugs

pull/4166/head
Daniel Gibbs 3 years ago
parent
commit
a6c121de77
No known key found for this signature in database GPG Key ID: 7CA38B43F78F12FE
  1. 2
      lgsm/modules/alert_gotify.sh
  2. 15
      lgsm/modules/check_permissions.sh
  3. 12
      lgsm/modules/command_monitor.sh
  4. 4
      lgsm/modules/command_start.sh
  5. 81
      lgsm/modules/command_update_linuxgsm.sh
  6. 96
      lgsm/modules/core_dl.sh
  7. 2
      lgsm/modules/core_functions.sh
  8. 61
      lgsm/modules/core_getopt.sh
  9. 5
      lgsm/modules/core_legacy.sh
  10. 908
      lgsm/modules/core_modules.sh
  11. 2
      lgsm/modules/fix_armar.sh
  12. 2
      lgsm/modules/fix_bt.sh
  13. 5
      lgsm/modules/query_gamedig.sh
  14. 143
      lgsm/modules/update_mumble.sh
  15. 8
      lgsm/modules/update_papermc.sh
  16. 2
      lgsm/modules/update_steamcmd.sh
  17. 2
      lgsm/modules/update_ut99.sh
  18. 18
      linuxgsm.sh
  19. 12
      tests/tests_fctrserver.sh
  20. 12
      tests/tests_jc2server.sh
  21. 12
      tests/tests_mcserver.sh
  22. 12
      tests/tests_ts3server.sh

2
lgsm/modules/alert_gotify.sh

@ -5,7 +5,7 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Sends Gotify alert. # Description: Sends Gotify alert.
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$( json=$(
cat << EOF cat << EOF

15
lgsm/modules/check_permissions.sh

@ -52,15 +52,9 @@ fn_check_ownership() {
fi fi
} }
<<<<<<< HEAD:lgsm/modules/check_permissions.sh fn_check_permissions() {
fn_check_permissions(){
if [ -d "${modulesdir}" ]; then if [ -d "${modulesdir}" ]; then
if [ "$(find "${modulesdir}" -type f -not -executable | wc -l)" -ne "0" ]; 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_print_fail_nl "Permissions issues found"
fn_script_log_fatal "Permissions issues found" fn_script_log_fatal "Permissions issues found"
fn_print_information_nl "The following files are not executable:" fn_print_information_nl "The following files are not executable:"
@ -229,15 +223,8 @@ fn_sys_perm_error_process() {
fi 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. ## Run permisions checks when not root or docker.
if [ "$(whoami)" != "root" ] && [ ! -f /.dockerenv ]; then if [ "$(whoami)" != "root" ] && [ ! -f /.dockerenv ]; then
>>>>>>> develop:lgsm/functions/check_permissions.sh
fn_check_ownership fn_check_ownership
fn_check_permissions fn_check_permissions
if [ "${commandname}" == "START" ]; then if [ "${commandname}" == "START" ]; then

12
lgsm/modules/command_monitor.sh

@ -26,9 +26,9 @@ fn_monitor_check_lockfile() {
# Fix if lockfile is not unix time or contains letters # 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 if [ -f "${lockdir}/${selfname}.lock" ] && [[ "$(head -n 1 "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then
date '+%s' >"${lockdir}/${selfname}.lock" date '+%s' > "${lockdir}/${selfname}.lock"
echo "${version}" >>"${lockdir}/${selfname}.lock" echo "${version}" >> "${lockdir}/${selfname}.lock"
echo "${port}" >>"${lockdir}/${selfname}.lock" echo "${port}" >> "${lockdir}/${selfname}.lock"
fi fi
} }
@ -87,12 +87,12 @@ fn_query_gsquery() {
if [ ! -f "${modulesdir}/query_gsquery.py" ]; then if [ ! -f "${modulesdir}/query_gsquery.py" ]; then
fn_fetch_file_github "lgsm/modules" "query_gsquery.py" "${modulesdir}" "chmodx" "norun" "noforce" "nohash" fn_fetch_file_github "lgsm/modules" "query_gsquery.py" "${modulesdir}" "chmodx" "norun" "noforce" "nohash"
fi 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="$?" querystatus="$?"
} }
fn_query_tcp() { 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="$?" querystatus="$?"
} }
@ -205,7 +205,7 @@ fn_monitor_loop() {
for querymethod in "${query_methods_array[@]}"; do for querymethod in "${query_methods_array[@]}"; do
# Will check if gamedig is installed and bypass if not. # Will check if gamedig is installed and bypass if not.
if [ "${querymethod}" == "gamedig" ]; then 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 if [ -z "${monitorpass}" ]; then
fn_monitor_query fn_monitor_query
fi fi

4
lgsm/modules/command_start.sh

@ -7,12 +7,8 @@
commandname="START" commandname="START"
commandaction="Starting" commandaction="Starting"
<<<<<<< HEAD:lgsm/modules/command_start.sh
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
=======
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
addtimestamp="gawk '{ print strftime(\\\"[$logtimestampformat]\\\"), \\\$0 }'" addtimestamp="gawk '{ print strftime(\\\"[$logtimestampformat]\\\"), \\\$0 }'"
>>>>>>> develop:lgsm/functions/command_start.sh
fn_firstcommand_set fn_firstcommand_set
fn_start_teamspeak3() { fn_start_teamspeak3() {

81
lgsm/modules/command_update_linuxgsm.sh

@ -180,95 +180,50 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
fi fi
fi fi
# Check and update modules. # Check and update modules.
<<<<<<< HEAD:lgsm/modules/command_update_linuxgsm.sh
if [ -n "${modulesdir}" ]; then if [ -n "${modulesdir}" ]; then
if [ -d "${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 cd "${modulesdir}" || exit
for functionfile in *; do for modulefile in *; do
# check if module exists in the repo and remove if missing. # check if module exists in the repo and remove if missing.
# commonly used if module names change. # commonly used if module names change.
echo -en "checking ${remotereponame} module ${functionfile}...\c" echo -en "checking ${remotereponame} module ${modulefile}...\c"
github_file_url_dir="lgsm/functions" github_file_url_dir="lgsm/modules"
if [ "${remotereponame}" == "GitHub" ]; then 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 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 fi
if [ $? != 0 ]; then if [ $? != 0 ]; then
fn_print_error_eol_nl fn_print_error_eol_nl
fn_script_log_error "Checking ${remotereponame} module ${functionfile}" fn_script_log_error "Checking ${remotereponame} module ${modulefile}"
echo -en "removing module ${functionfile}...\c" echo -en "removing module ${modulefile}...\c"
if ! rm -f "${functionfile:?}"; then if ! rm -f "${modulefile:?}"; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_script_log_fatal "Removing module ${functionfile}" fn_script_log_fatal "Removing module ${modulefile}"
core_exit.sh core_exit.sh
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Removing module ${functionfile}" fn_script_log_pass "Removing module ${modulefile}"
fi fi
else else
# compare file # compare file
if [ "${remotereponame}" == "GitHub" ]; then 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 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 fi
# results # results
if [ "${function_file_diff}" != "" ]; then if [ "${module_file_diff}" != "" ]; then
fn_print_update_eol_nl fn_print_update_eol_nl
fn_script_log_update "Checking ${remotereponame} module ${functionfile}" fn_script_log_update "Checking ${remotereponame} module ${modulefile}"
rm -rf "${functionsdir:?}/${functionfile}" rm -rf "${modulesdir:?}/${modulefile}"
fn_update_function fn_update_module
else else
fn_print_ok_eol_nl fn_print_ok_eol_nl
fn_script_log_pass "Checking ${remotereponame} module ${functionfile}" fn_script_log_pass "Checking ${remotereponame} module ${modulefile}"
fi fi
>>>>>>> develop:lgsm/functions/command_update_linuxgsm.sh
fi fi
done done
) )

96
lgsm/modules/core_dl.sh

@ -456,10 +456,10 @@ fn_fetch_file() {
# GitHub file download modules. # GitHub file download modules.
# Used to simplify downloading specific files from GitHub. # Used to simplify downloading specific files from GitHub.
# github_fileurl_dir: the directory of the file in the GitHub: lgsm/modules # github_file_url_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_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_file_url_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_name: the filename of the file to download from GitHub: core_messages.sh
# githuburl: the full GitHub url # githuburl: the full GitHub url
# remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2 # remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2
@ -472,24 +472,24 @@ fn_fetch_file() {
# Fetches files from the Git repo. # Fetches files from the Git repo.
fn_fetch_file_github() { fn_fetch_file_github() {
github_fileurl_dir="${1}" github_file_url_dir="${1}"
github_fileurl_name="${2}" github_file_url_name="${2}"
# For legacy versions - code can be removed at a future date # For legacy versions - code can be removed at a future date
if [ "${legacymode}" == "1" ]; then if [ "${legacymode}" == "1" ]; then
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_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. # 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 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="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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
local_filedir="${3}" local_filedir="${3}"
local_filename="${github_fileurl_name}" local_filename="${github_file_url_name}"
chmodx="${4:-0}" chmodx="${4:-0}"
run="${5:-0}" run="${5:-0}"
forcedl="${6:-0}" forcedl="${6:-0}"
@ -499,31 +499,31 @@ fn_fetch_file_github() {
} }
fn_check_file_github() { fn_check_file_github() {
github_fileurl_dir="${1}" github_file_url_dir="${1}"
github_fileurl_name="${2}" github_file_url_name="${2}"
if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then 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="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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" 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. # Fetches config files from the Git repo.
fn_fetch_config() { fn_fetch_config() {
github_fileurl_dir="${1}" github_file_url_dir="${1}"
github_fileurl_name="${2}" github_file_url_name="${2}"
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. # 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 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="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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
@ -538,29 +538,21 @@ fn_fetch_config() {
} }
# Fetches modules from the Git repo during first download. # 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() { fn_fetch_function() {
github_fileurl_dir="lgsm/functions" github_file_url_dir="lgsm/modules"
github_fileurl_name="${functionfile}" github_file_url_name="${modulefile}"
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. # 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 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_file_url_dir}/${github_file_url_name}"
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_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
local_filedir="${modulesdir}" local_filedir="${modulesdir}"
local_filename="${github_fileurl_name}" local_filename="${github_file_url_name}"
chmodx="chmodx" chmodx="chmodx"
run="run" run="run"
forcedl="noforce" forcedl="noforce"
@ -570,27 +562,21 @@ fn_fetch_function() {
} }
# Fetches modules from the Git repo during update-lgsm. # Fetches modules from the Git repo during update-lgsm.
<<<<<<< HEAD:lgsm/modules/core_dl.sh fn_update_module() {
fn_update_module(){ github_file_url_dir="lgsm/modules"
github_fileurl_dir="lgsm/modules" github_file_url_name="${modulefile}"
github_fileurl_name="${modulefile}"
=======
fn_update_function() {
github_fileurl_dir="lgsm/functions"
github_fileurl_name="${functionfile}"
>>>>>>> develop:lgsm/functions/core_dl.sh
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork. # 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 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="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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
local_filedir="${modulesdir}" local_filedir="${modulesdir}"
local_filename="${github_fileurl_name}" local_filename="${github_file_url_name}"
chmodx="chmodx" chmodx="chmodx"
run="norun" run="norun"
forcedl="noforce" forcedl="noforce"

2
lgsm/modules/core_functions.sh

@ -6,7 +6,7 @@
# Description: Defines all functions to allow download and execution of functions using fn_fetch_function. # 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. # 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" modulesversion="v23.2.0"

61
lgsm/modules/core_getopt.sh

@ -10,37 +10,20 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
### Define all commands here. ### Define all commands here.
## User commands | Trigger commands | Description ## User commands | Trigger commands | Description
# Standard commands. # Standard commands.
<<<<<<< HEAD:lgsm/modules/core_getopt.sh cmd_installr=("i;install" "command_install.sh" "Install the server.")
cmd_install=( "i;install" "command_install.sh" "Install the server." ) cmd_auto_installr=("ai;auto-install" "fn_autoinstall" "Install the server without prompts.")
cmd_auto_install=( "ai;auto-install" "fn_autoinstall" "Install the server without prompts." ) cmd_startr=("st;start" "command_start.sh" "Start the server.")
cmd_start=( "st;start" "command_start.sh" "Start the server." ) cmd_stopr=("sp;stop" "command_stop.sh" "Stop the server.")
cmd_stop=( "sp;stop" "command_stop.sh" "Stop the server." ) cmd_restartr=("r;restart" "command_restart.sh" "Restart the server.")
cmd_restart=( "r;restart" "command_restart.sh" "Restart the server." ) cmd_detailsr=("dt;details" "command_details.sh" "Display server information.")
cmd_details=( "dt;details" "command_details.sh" "Display server information." ) cmd_postdetailsr=("pd;postdetails" "command_postdetails.sh" "Post details to termbin.com (removing passwords).")
cmd_postdetails=( "pd;postdetails" "command_postdetails.sh" "Post details to termbin.com (removing passwords)." ) cmd_backupr=("b;backup" "command_backup.sh" "Create backup archives of the server.")
cmd_backup=( "b;backup" "command_backup.sh" "Create backup archives of the server." ) cmd_update_linuxgsmr=("ul;update-lgsm;uf;update-modules" "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_alertr=("ta;test-alert" "command_test_alert.sh" "Send a test alert.")
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.")
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-functions" "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_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_skeletonr=("sk;skeleton" "command_skeleton.sh" "Create a skeleton directory.")
cmd_sponsor=("s;sponsor" "command_sponsor.sh" "Donation options.") cmd_sponsor=("s;sponsor" "command_sponsor.sh" "Donation options.")
cmd_send=("sd;send" "command_send.sh" "Send command to game server console.") cmd_send=("sd;send" "command_send.sh" "Send command to game server console.")
>>>>>>> develop:lgsm/functions/core_getopt.sh
# Console servers only. # Console servers only.
cmd_console=("c;console" "command_console.sh" "Access server console.") cmd_console=("c;console" "command_console.sh" "Access server console.")
cmd_debug=("d;debug" "command_debug.sh" "Start server directly in your terminal.") 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_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.") cmd_fastdl=("fd;fastdl" "command_fastdl.sh" "Build a FastDL directory.")
# Dev commands. # 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_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_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_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_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_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.") cmd_dev_clear_modules=("cf;clear-modules" "command_dev_clear_modules.sh" "Delete the contents of the modules dir.")
>>>>>>> develop:lgsm/functions/core_getopt.sh
### Set specific opt here. ### Set specific opt here.
@ -172,19 +145,11 @@ currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}")
## Developer commands. ## Developer commands.
currentopt+=("${cmd_dev_debug[@]}") currentopt+=("${cmd_dev_debug[@]}")
if [ -f ".dev-debug" ]; then 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[@]}")
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[@]}")
fi fi
## Sponsor. ## Sponsor.
currentopt+=("${cmd_sponsor[@]}") currentopt+=("${cmd_sponsor[@]}")
>>>>>>> develop:lgsm/functions/core_getopt.sh
### Build list of available commands. ### Build list of available commands.
optcommands=() optcommands=()

5
lgsm/modules/core_legacy.sh

@ -78,7 +78,6 @@ if [ -z "${wsstartmap}" ]; then
fi fi
fi fi
<<<<<<< HEAD:lgsm/modules/core_legacy.sh
# Added as part of migrating functions dir to modules dir. # Added as part of migrating functions dir to modules dir.
# Will remove functions dir if files in modules dir older than 14 days # Will remove functions dir if files in modules dir older than 14 days
functionsdir="${lgsmdir}/modules" functionsdir="${lgsmdir}/modules"
@ -87,10 +86,8 @@ if [ -d "${lgsmdir}/functions" ]; then
rm -rf "${lgsmdir:?}/functions" rm -rf "${lgsmdir:?}/functions"
fi fi
fi fi
fn_parms(){
=======
fn_parms() { fn_parms() {
>>>>>>> develop:lgsm/functions/core_legacy.sh
fn_reload_startparameters fn_reload_startparameters
parms="${startparameters}" parms="${startparameters}"
} }

908
lgsm/modules/core_modules.sh

File diff suppressed because it is too large

2
lgsm/modules/fix_armar.sh

@ -5,7 +5,7 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Resolves an issue with Arma Reforger. # 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. # Fixes: Profile directory doesn't exist.
# Issue Link: https://feedback.bistudio.com/T164845 # Issue Link: https://feedback.bistudio.com/T164845

2
lgsm/modules/fix_bt.sh

@ -5,7 +5,7 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Resolves an issue with Barotrauma. # 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. # Fixes: Missing user data directory error.
if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma" ]; then if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Daedalic Entertainment GmbH/Barotrauma" ]; then

5
lgsm/modules/query_gamedig.sh

@ -6,13 +6,8 @@
# Description: Querys a gameserver using node-gamedig. # Description: Querys a gameserver using node-gamedig.
# https://github.com/sonicsnes/node-gamedig # https://github.com/sonicsnes/node-gamedig
<<<<<<< HEAD:lgsm/modules/query_gamedig.sh
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
=======
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
querystatus="2" querystatus="2"
>>>>>>> develop:lgsm/functions/query_gamedig.sh
# Check if gamedig and jq are installed. # Check if gamedig and jq are installed.
if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then

143
lgsm/modules/update_mumble.sh

@ -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

8
lgsm/modules/update_papermc.sh

@ -5,13 +5,7 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Handles updating of PaperMC and Waterfall servers. # Description: Handles updating of PaperMC and Waterfall servers.
<<<<<<< HEAD:lgsm/modules/update_papermc.sh module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
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
fn_update_dl() { fn_update_dl() {
# Download and extract files to serverfiles # Download and extract files to serverfiles

2
lgsm/modules/update_steamcmd.sh

@ -18,7 +18,7 @@ fn_print_dots "${remotelocation}"
if [ "${forceupdate}" == "1" ]; then if [ "${forceupdate}" == "1" ]; then
# forceupdate bypasses update checks. # forceupdate bypasses update checks.
if [ "${status}" != "0" ]&&[ -v "${status}" ]; then if [ "${status}" != "0" ] && [ -v "${status}" ]; then
fn_print_restart_warning fn_print_restart_warning
exitbypass=1 exitbypass=1
command_stop.sh command_stop.sh

2
lgsm/modules/update_ut99.sh

@ -5,7 +5,7 @@
# Website: https://linuxgsm.com # Website: https://linuxgsm.com
# Description: Handles updating of Unreal Tournament 99 servers. # 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() { fn_update_dl() {
# Download and extract files to serverfiles # Download and extract files to serverfiles

18
linuxgsm.sh

@ -51,15 +51,21 @@ userinput2="${2}"
[ -n "${LGSM_GITHUBREPO}" ] && githubrepo="${LGSM_GITHUBREPO}" || githubrepo="LinuxGSM" [ -n "${LGSM_GITHUBREPO}" ] && githubrepo="${LGSM_GITHUBREPO}" || githubrepo="LinuxGSM"
[ -n "${LGSM_GITHUBBRANCH}" ] && githubbranch="${LGSM_GITHUBBRANCH}" || githubbranch="master" [ -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 module that is required first.
core_modules.sh(){ core_modules.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nomd5" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nomd5"
} }
# Bootstrap # Bootstrap
# Fetches the core modules required before passed off to core_dl.sh. # 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="${1}"
remote_fileurl_backup="${2}" remote_fileurl_backup="${2}"
remote_fileurl_name="${3}" 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="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}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
local_filedir="${3}" local_filedir="${3}"
local_filename="${github_fileurl_name}" local_filename="${github_file_url_name}"
chmodx="${4:-0}" chmodx="${4:-0}"
run="${5:-0}" run="${5:-0}"
forcedl="${6:-0}" forcedl="${6:-0}"
@ -321,7 +327,7 @@ if [ "$(whoami)" == "root" ] && [ ! -f /.dockerenv ]; then
echo -e "[ FAIL ] Do NOT run this script as root!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
fi 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!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
else else

12
tests/tests_fctrserver.sh

@ -58,14 +58,14 @@ githubrepo="LinuxGSM"
githubbranch="${TRAVIS_BRANCH}" githubbranch="${TRAVIS_BRANCH}"
# Core module that is required first. # Core module that is required first.
core_modules.sh(){ core_modules.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
} }
# Bootstrap # Bootstrap
# Fetches the core modules required before passed off to core_dl.sh. # 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="${1}"
remote_fileurl_backup="${2}" remote_fileurl_backup="${2}"
remote_fileurl_name="${3}" 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="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}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
local_filedir="${3}" local_filedir="${3}"
local_filename="${github_fileurl_name}" local_filename="${github_file_url_name}"
chmodx="${4:-0}" chmodx="${4:-0}"
run="${5:-0}" run="${5:-0}"
forcedl="${6:-0}" forcedl="${6:-0}"
@ -327,7 +327,7 @@ if [ "$(whoami)" == "root" ]; then
echo -e "[ FAIL ] Do NOT run this script as root!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
fi 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!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
else else

12
tests/tests_jc2server.sh

@ -59,14 +59,14 @@ githubrepo="LinuxGSM"
githubbranch="${TRAVIS_BRANCH}" githubbranch="${TRAVIS_BRANCH}"
# Core module that is required first. # Core module that is required first.
core_modules.sh(){ core_modules.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
} }
# Bootstrap # Bootstrap
# Fetches the core modules required before passed off to core_dl.sh. # 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="${1}"
remote_fileurl_backup="${2}" remote_fileurl_backup="${2}"
remote_fileurl_name="${3}" 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="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}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
local_filedir="${3}" local_filedir="${3}"
local_filename="${github_fileurl_name}" local_filename="${github_file_url_name}"
chmodx="${4:-0}" chmodx="${4:-0}"
run="${5:-0}" run="${5:-0}"
forcedl="${6:-0}" forcedl="${6:-0}"
@ -328,7 +328,7 @@ if [ "$(whoami)" == "root" ]; then
echo -e "[ FAIL ] Do NOT run this script as root!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
fi 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!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
else else

12
tests/tests_mcserver.sh

@ -59,14 +59,14 @@ githubrepo="LinuxGSM"
githubbranch="${TRAVIS_BRANCH}" githubbranch="${TRAVIS_BRANCH}"
# Core module that is required first. # Core module that is required first.
core_modules.sh(){ core_modules.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
} }
# Bootstrap # Bootstrap
# Fetches the core modules required before passed off to core_dl.sh. # 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="${1}"
remote_fileurl_backup="${2}" remote_fileurl_backup="${2}"
remote_fileurl_name="${3}" 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="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}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
local_filedir="${3}" local_filedir="${3}"
local_filename="${github_fileurl_name}" local_filename="${github_file_url_name}"
chmodx="${4:-0}" chmodx="${4:-0}"
run="${5:-0}" run="${5:-0}"
forcedl="${6:-0}" forcedl="${6:-0}"
@ -328,7 +328,7 @@ if [ "$(whoami)" == "root" ]; then
echo -e "[ FAIL ] Do NOT run this script as root!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
fi 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!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
else else

12
tests/tests_ts3server.sh

@ -59,14 +59,14 @@ githubrepo="LinuxGSM"
githubbranch="${TRAVIS_BRANCH}" githubbranch="${TRAVIS_BRANCH}"
# Core module that is required first. # Core module that is required first.
core_modules.sh(){ core_modules.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash" fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nohash"
} }
# Bootstrap # Bootstrap
# Fetches the core modules required before passed off to core_dl.sh. # 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="${1}"
remote_fileurl_backup="${2}" remote_fileurl_backup="${2}"
remote_fileurl_name="${3}" 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="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}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
else else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${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_fileurl_dir}/${github_fileurl_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
fi fi
remote_fileurl_name="GitHub" remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket" remote_fileurl_backup_name="Bitbucket"
local_filedir="${3}" local_filedir="${3}"
local_filename="${github_fileurl_name}" local_filename="${github_file_url_name}"
chmodx="${4:-0}" chmodx="${4:-0}"
run="${5:-0}" run="${5:-0}"
forcedl="${6:-0}" forcedl="${6:-0}"
@ -328,7 +328,7 @@ if [ "$(whoami)" == "root" ]; then
echo -e "[ FAIL ] Do NOT run this script as root!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
fi 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!" echo -e "[ FAIL ] Do NOT run this script as root!"
exit 1 exit 1
else else

Loading…
Cancel
Save