From 0bec0ca21889a4f801a62b302b3e19b3ec6c7dc4 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 5 Apr 2023 00:16:37 +0100 Subject: [PATCH] feat: convert functions dir to modules dir (#4169) * functions dir will be deleted after 14 days --- .github/workflows/version-check.sh | 2 +- lgsm/functions/core_dl.sh | 100 +-- lgsm/functions/core_exit.sh | 18 +- lgsm/functions/core_functions.sh | 2 +- lgsm/functions/core_getopt.sh | 10 +- lgsm/functions/core_github.sh | 6 +- lgsm/functions/core_legacy.sh | 11 +- lgsm/functions/core_logs.sh | 2 +- lgsm/functions/core_messages.sh | 2 +- lgsm/functions/core_modules.sh | 816 ++++++++++++++++++ lgsm/functions/core_steamcmd.sh | 4 +- lgsm/functions/core_trap.sh | 2 +- lgsm/{functions => modules}/README.md | 0 lgsm/{functions => modules}/alert.sh | 4 +- lgsm/{functions => modules}/alert_discord.sh | 2 +- lgsm/{functions => modules}/alert_email.sh | 2 +- lgsm/{functions => modules}/alert_gotify.sh | 2 +- lgsm/{functions => modules}/alert_ifttt.sh | 2 +- lgsm/{functions => modules}/alert_mailgun.sh | 2 +- .../alert_pushbullet.sh | 2 +- lgsm/{functions => modules}/alert_pushover.sh | 2 +- .../alert_rocketchat.sh | 2 +- lgsm/{functions => modules}/alert_slack.sh | 2 +- lgsm/{functions => modules}/alert_telegram.sh | 2 +- lgsm/{functions => modules}/check.sh | 4 +- lgsm/{functions => modules}/check_config.sh | 2 +- lgsm/{functions => modules}/check_deps.sh | 2 +- .../check_executable.sh | 2 +- lgsm/{functions => modules}/check_glibc.sh | 2 +- lgsm/{functions => modules}/check_ip.sh | 2 +- .../check_last_update.sh | 2 +- lgsm/{functions => modules}/check_logs.sh | 2 +- .../check_permissions.sh | 16 +- lgsm/{functions => modules}/check_root.sh | 2 +- lgsm/{functions => modules}/check_status.sh | 2 +- lgsm/{functions => modules}/check_steamcmd.sh | 4 +- .../check_system_dir.sh | 2 +- .../check_system_requirements.sh | 2 +- .../check_tmuxception.sh | 2 +- lgsm/{functions => modules}/check_version.sh | 2 +- lgsm/{functions => modules}/command_backup.sh | 2 +- .../command_check_update.sh | 2 +- .../{functions => modules}/command_console.sh | 2 +- lgsm/{functions => modules}/command_debug.sh | 2 +- .../{functions => modules}/command_details.sh | 2 +- .../command_dev_clear_modules.sh} | 12 +- .../command_dev_debug.sh | 2 +- .../command_dev_detect_deps.sh | 2 +- .../command_dev_detect_glibc.sh | 2 +- .../command_dev_detect_ldd.sh | 2 +- .../command_dev_query_raw.sh | 8 +- lgsm/{functions => modules}/command_fastdl.sh | 2 +- .../{functions => modules}/command_install.sh | 4 +- .../command_install_resources_mta.sh | 2 +- .../command_mods_install.sh | 2 +- .../command_mods_remove.sh | 2 +- .../command_mods_update.sh | 2 +- .../{functions => modules}/command_monitor.sh | 8 +- .../command_postdetails.sh | 4 +- .../{functions => modules}/command_restart.sh | 2 +- lgsm/{functions => modules}/command_send.sh | 2 +- .../command_skeleton.sh | 2 +- .../{functions => modules}/command_sponsor.sh | 2 +- lgsm/{functions => modules}/command_start.sh | 2 +- lgsm/{functions => modules}/command_stop.sh | 2 +- .../command_test_alert.sh | 2 +- .../command_ts3_server_pass.sh | 2 +- lgsm/{functions => modules}/command_update.sh | 2 +- .../command_update_linuxgsm.sh | 48 +- .../command_validate.sh | 2 +- lgsm/{functions => modules}/command_wipe.sh | 2 +- .../compress_unreal2_maps.sh | 2 +- .../compress_ut99_maps.sh | 2 +- lgsm/modules/core_dl.sh | 627 ++++++++++++++ lgsm/modules/core_exit.sh | 61 ++ lgsm/modules/core_functions.sh | 816 ++++++++++++++++++ lgsm/modules/core_getopt.sh | 215 +++++ lgsm/modules/core_github.sh | 114 +++ lgsm/modules/core_legacy.sh | 93 ++ lgsm/modules/core_logs.sh | 110 +++ lgsm/modules/core_messages.sh | 598 +++++++++++++ lgsm/modules/core_modules.sh | 816 ++++++++++++++++++ lgsm/modules/core_steamcmd.sh | 330 +++++++ lgsm/modules/core_trap.sh | 22 + lgsm/{functions => modules}/fix.sh | 8 +- lgsm/{functions => modules}/fix_ark.sh | 2 +- lgsm/{functions => modules}/fix_arma3.sh | 2 +- lgsm/{functions => modules}/fix_armar.sh | 2 +- lgsm/{functions => modules}/fix_av.sh | 2 +- lgsm/{functions => modules}/fix_bo.sh | 2 +- lgsm/{functions => modules}/fix_bt.sh | 2 +- lgsm/{functions => modules}/fix_cmw.sh | 2 +- lgsm/{functions => modules}/fix_csgo.sh | 2 +- lgsm/{functions => modules}/fix_dst.sh | 2 +- lgsm/{functions => modules}/fix_hw.sh | 2 +- lgsm/{functions => modules}/fix_ins.sh | 2 +- lgsm/{functions => modules}/fix_kf.sh | 2 +- lgsm/{functions => modules}/fix_kf2.sh | 2 +- lgsm/{functions => modules}/fix_lo.sh | 4 +- lgsm/{functions => modules}/fix_mcb.sh | 2 +- lgsm/{functions => modules}/fix_mta.sh | 2 +- lgsm/{functions => modules}/fix_nmrih.sh | 2 +- lgsm/{functions => modules}/fix_onset.sh | 2 +- lgsm/{functions => modules}/fix_ro.sh | 2 +- lgsm/{functions => modules}/fix_rust.sh | 2 +- lgsm/{functions => modules}/fix_rw.sh | 2 +- lgsm/{functions => modules}/fix_samp.sh | 2 +- lgsm/{functions => modules}/fix_sdtd.sh | 2 +- lgsm/{functions => modules}/fix_sfc.sh | 2 +- lgsm/{functions => modules}/fix_sof2.sh | 2 +- lgsm/{functions => modules}/fix_squad.sh | 2 +- lgsm/{functions => modules}/fix_st.sh | 2 +- lgsm/{functions => modules}/fix_steamcmd.sh | 2 +- lgsm/{functions => modules}/fix_terraria.sh | 2 +- lgsm/{functions => modules}/fix_tf2.sh | 2 +- lgsm/{functions => modules}/fix_ts3.sh | 2 +- lgsm/{functions => modules}/fix_unt.sh | 2 +- lgsm/{functions => modules}/fix_ut.sh | 2 +- lgsm/{functions => modules}/fix_ut2k4.sh | 2 +- lgsm/{functions => modules}/fix_ut3.sh | 2 +- lgsm/{functions => modules}/fix_vh.sh | 4 +- lgsm/{functions => modules}/fix_wurm.sh | 2 +- lgsm/{functions => modules}/fix_zmr.sh | 2 +- lgsm/{functions => modules}/info_distro.sh | 2 +- lgsm/{functions => modules}/info_game.sh | 2 +- lgsm/{functions => modules}/info_messages.sh | 2 +- lgsm/{functions => modules}/info_stats.sh | 2 +- .../install_complete.sh | 2 +- lgsm/{functions => modules}/install_config.sh | 2 +- .../install_dst_token.sh | 2 +- lgsm/{functions => modules}/install_eula.sh | 2 +- .../install_factorio_save.sh | 2 +- lgsm/{functions => modules}/install_gslt.sh | 2 +- lgsm/{functions => modules}/install_header.sh | 2 +- lgsm/{functions => modules}/install_logs.sh | 2 +- .../install_mta_resources.sh | 2 +- lgsm/{functions => modules}/install_retry.sh | 2 +- .../install_server_dir.sh | 2 +- .../install_server_files.sh | 2 +- .../install_squad_license.sh | 2 +- lgsm/{functions => modules}/install_stats.sh | 2 +- .../install_steamcmd.sh | 2 +- lgsm/{functions => modules}/install_ts3db.sh | 2 +- .../install_ut2k4_key.sh | 2 +- lgsm/{functions => modules}/mods_core.sh | 4 +- lgsm/{functions => modules}/mods_list.sh | 2 +- lgsm/{functions => modules}/query_gamedig.sh | 2 +- lgsm/{functions => modules}/query_gsquery.py | 2 +- .../{functions => modules}/update_factorio.sh | 2 +- .../update_jediknight2.sh | 2 +- .../update_minecraft.sh | 2 +- .../update_minecraft_bedrock.sh | 2 +- lgsm/{functions => modules}/update_mta.sh | 2 +- lgsm/{functions => modules}/update_papermc.sh | 4 +- .../{functions => modules}/update_steamcmd.sh | 4 +- lgsm/{functions => modules}/update_ts3.sh | 2 +- lgsm/{functions => modules}/update_ut99.sh | 2 +- .../update_vintagestory.sh | 2 +- linuxgsm.sh | 24 +- tests/tests_fctrserver.sh | 80 +- tests/tests_jc2server.sh | 94 +- tests/tests_mcserver.sh | 80 +- tests/tests_ts3server.sh | 80 +- 163 files changed, 5070 insertions(+), 441 deletions(-) mode change 100755 => 100644 lgsm/functions/core_dl.sh mode change 100755 => 100644 lgsm/functions/core_exit.sh mode change 100755 => 100644 lgsm/functions/core_getopt.sh mode change 100755 => 100644 lgsm/functions/core_legacy.sh mode change 100755 => 100644 lgsm/functions/core_logs.sh mode change 100755 => 100644 lgsm/functions/core_messages.sh create mode 100644 lgsm/functions/core_modules.sh mode change 100755 => 100644 lgsm/functions/core_steamcmd.sh mode change 100755 => 100644 lgsm/functions/core_trap.sh rename lgsm/{functions => modules}/README.md (100%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert.sh (98%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_discord.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_email.sh (90%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_gotify.sh (93%) rename lgsm/{functions => modules}/alert_ifttt.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_mailgun.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_pushbullet.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_pushover.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_rocketchat.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_slack.sh (96%) mode change 100755 => 100644 rename lgsm/{functions => modules}/alert_telegram.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_config.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_deps.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_executable.sh (89%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_glibc.sh (92%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_ip.sh (96%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_last_update.sh (92%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_logs.sh (90%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_permissions.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_root.sh (89%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_status.sh (82%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_steamcmd.sh (82%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_system_dir.sh (88%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_system_requirements.sh (96%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_tmuxception.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/check_version.sh (91%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_backup.sh (99%) rename lgsm/{functions => modules}/command_check_update.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_console.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_debug.sh (98%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_details.sh (93%) mode change 100755 => 100644 rename lgsm/{functions/command_dev_clear_functions.sh => modules/command_dev_clear_modules.sh} (60%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_dev_debug.sh (89%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_dev_detect_deps.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_dev_detect_glibc.sh (97%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_dev_detect_ldd.sh (96%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_dev_query_raw.sh (97%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_fastdl.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_install.sh (90%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_install_resources_mta.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_mods_install.sh (98%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_mods_remove.sh (98%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_mods_update.sh (98%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_monitor.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_postdetails.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_restart.sh (83%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_send.sh (93%) rename lgsm/{functions => modules}/command_skeleton.sh (91%) rename lgsm/{functions => modules}/command_sponsor.sh (91%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_start.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_stop.sh (99%) rename lgsm/{functions => modules}/command_test_alert.sh (83%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_ts3_server_pass.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_update.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_update_linuxgsm.sh (86%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_validate.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/command_wipe.sh (98%) mode change 100755 => 100644 rename lgsm/{functions => modules}/compress_unreal2_maps.sh (92%) mode change 100755 => 100644 rename lgsm/{functions => modules}/compress_ut99_maps.sh (92%) mode change 100755 => 100644 create mode 100644 lgsm/modules/core_dl.sh create mode 100644 lgsm/modules/core_exit.sh create mode 100755 lgsm/modules/core_functions.sh create mode 100644 lgsm/modules/core_getopt.sh create mode 100644 lgsm/modules/core_github.sh create mode 100644 lgsm/modules/core_legacy.sh create mode 100644 lgsm/modules/core_logs.sh create mode 100644 lgsm/modules/core_messages.sh create mode 100644 lgsm/modules/core_modules.sh create mode 100644 lgsm/modules/core_steamcmd.sh create mode 100644 lgsm/modules/core_trap.sh rename lgsm/{functions => modules}/fix.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_ark.sh (97%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_arma3.sh (89%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_armar.sh (86%) rename lgsm/{functions => modules}/fix_av.sh (90%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_bo.sh (81%) rename lgsm/{functions => modules}/fix_bt.sh (91%) rename lgsm/{functions => modules}/fix_cmw.sh (89%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_csgo.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_dst.sh (91%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_hw.sh (81%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_ins.sh (89%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_kf.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_kf2.sh (87%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_lo.sh (80%) rename lgsm/{functions => modules}/fix_mcb.sh (84%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_mta.sh (89%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_nmrih.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_onset.sh (91%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_ro.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_rust.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_rw.sh (80%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_samp.sh (94%) rename lgsm/{functions => modules}/fix_sdtd.sh (81%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_sfc.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_sof2.sh (82%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_squad.sh (92%) rename lgsm/{functions => modules}/fix_st.sh (84%) rename lgsm/{functions => modules}/fix_steamcmd.sh (98%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_terraria.sh (75%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_tf2.sh (88%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_ts3.sh (94%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_unt.sh (81%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_ut.sh (83%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_ut2k4.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_ut3.sh (91%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_vh.sh (92%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_wurm.sh (87%) mode change 100755 => 100644 rename lgsm/{functions => modules}/fix_zmr.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/info_distro.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/info_game.sh (99%) rename lgsm/{functions => modules}/info_messages.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/info_stats.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_complete.sh (86%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_config.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_dst_token.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_eula.sh (95%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_factorio_save.sh (86%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_gslt.sh (96%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_header.sh (91%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_logs.sh (97%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_mta_resources.sh (88%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_retry.sh (82%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_server_dir.sh (89%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_server_files.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_squad_license.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_stats.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_steamcmd.sh (83%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_ts3db.sh (97%) mode change 100755 => 100644 rename lgsm/{functions => modules}/install_ut2k4_key.sh (93%) mode change 100755 => 100644 rename lgsm/{functions => modules}/mods_core.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/mods_list.sh (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/query_gamedig.sh (97%) mode change 100755 => 100644 rename lgsm/{functions => modules}/query_gsquery.py (99%) mode change 100755 => 100644 rename lgsm/{functions => modules}/update_factorio.sh (98%) rename lgsm/{functions => modules}/update_jediknight2.sh (98%) rename lgsm/{functions => modules}/update_minecraft.sh (98%) rename lgsm/{functions => modules}/update_minecraft_bedrock.sh (98%) rename lgsm/{functions => modules}/update_mta.sh (98%) rename lgsm/{functions => modules}/update_papermc.sh (98%) rename lgsm/{functions => modules}/update_steamcmd.sh (87%) rename lgsm/{functions => modules}/update_ts3.sh (98%) rename lgsm/{functions => modules}/update_ut99.sh (98%) rename lgsm/{functions => modules}/update_vintagestory.sh (98%) mode change 100755 => 100644 diff --git a/.github/workflows/version-check.sh b/.github/workflows/version-check.sh index 4e7280509..a5f21c5cb 100644 --- a/.github/workflows/version-check.sh +++ b/.github/workflows/version-check.sh @@ -1,6 +1,6 @@ #!/bin/bash version=$(grep "version=" linuxgsm.sh | sed -e 's/version//g' | tr -d '="') -modulesversion=$(grep "modulesversion=" lgsm/functions/core_functions.sh | sed -e 's/modulesversion//g' | tr -d '="') +modulesversion=$(grep "modulesversion=" lgsm/modules/core_modules.sh | sed -e 's/modulesversion//g' | tr -d '="') if [ "${version}" != "${modulesversion}" ]; then echo "Error! LinuxGSM version mismatch" diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh old mode 100755 new mode 100644 index 27d001285..405e9dc6b --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -17,7 +17,7 @@ # fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" # fn_fetch_file "http://example.com/file.tar.bz2" "http://example.com/file2.tar.bz2" "file.tar.bz2" "file2.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_dl_steamcmd() { fn_print_start_nl "${remotelocation}" @@ -453,11 +453,13 @@ fn_fetch_file() { fi } -# GitHub file download functions. +# GitHub file download modules. # Used to simplify downloading specific files from GitHub. -# github_fileurl_dir: the directory of the file in the GitHub: lgsm/functions -# 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 @@ -470,58 +472,58 @@ 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}" hash="${7:-0}" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" } 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" @@ -531,55 +533,55 @@ fn_fetch_config() { run="norun" forcedl="noforce" hash="nohash" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" } # Fetches modules from the Git repo during first download. -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 - 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="${functionsdir}" - local_filename="${github_fileurl_name}" + local_filedir="${modulesdir}" + local_filename="${github_file_url_name}" chmodx="chmodx" run="run" forcedl="noforce" hash="nohash" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" } # Fetches modules from the Git repo during update-lgsm. -fn_update_function() { - github_fileurl_dir="lgsm/functions" - github_fileurl_name="${functionfile}" +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="${functionsdir}" - local_filename="${github_fileurl_name}" + local_filedir="${modulesdir}" + local_filename="${github_file_url_name}" chmodx="chmodx" run="norun" forcedl="noforce" hash="nohash" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" } @@ -618,7 +620,7 @@ fn_dl_latest_release_github() { fn_print_fail_nl "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}" fn_script_log_fatal "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}" else - # Fetch file from the remote location from the existing function to the ${tmpdir} for now. + # Fetch file from the remote location from the existing module to the ${tmpdir} for now. fn_fetch_file "${githubreleasedownloadlink}" "" "${githubreleasefilename}" "" "${githubreleasedownloadpath}" "${githubreleasefilename}" fi fi diff --git a/lgsm/functions/core_exit.sh b/lgsm/functions/core_exit.sh old mode 100755 new mode 100644 index 95d9d8cae..a8686c2a8 --- a/lgsm/functions/core_exit.sh +++ b/lgsm/functions/core_exit.sh @@ -5,14 +5,14 @@ # Website: https://linuxgsm.com # Description: Handles exiting of LinuxGSM by running and reporting an exit code. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_exit_dev_debug() { if [ -f "${rootdir}/.dev-debug" ]; then echo -e "" - echo -e "${functionselfname} exiting with code: ${exitcode}" + echo -e "${moduleselfname} exiting with code: ${exitcode}" if [ -f "${rootdir}/dev-debug.log" ]; then - grep "functionfile=" "${rootdir}/dev-debug.log" | sed 's/functionfile=//g' > "${rootdir}/dev-debug-function-order.log" + grep "modulefile=" "${rootdir}/dev-debug.log" | sed 's/modulefile=//g' > "${rootdir}/dev-debug-module-order.log" fi fi } @@ -29,13 +29,13 @@ elif [ "${exitcode}" != "0" ]; then # List LinuxGSM version in logs fn_script_log_info "LinuxGSM version: ${version}" if [ "${exitcode}" == "1" ]; then - fn_script_log_fatal "${functionselfname} exiting with code: ${exitcode}" + fn_script_log_fatal "${moduleselfname} exiting with code: ${exitcode}" elif [ "${exitcode}" == "2" ]; then - fn_script_log_error "${functionselfname} exiting with code: ${exitcode}" + fn_script_log_error "${moduleselfname} exiting with code: ${exitcode}" elif [ "${exitcode}" == "3" ]; then - fn_script_log_warn "${functionselfname} exiting with code: ${exitcode}" + fn_script_log_warn "${moduleselfname} exiting with code: ${exitcode}" else - fn_script_log_warn "${functionselfname} exiting with code: ${exitcode}" + fn_script_log_warn "${moduleselfname} exiting with code: ${exitcode}" fi fn_exit_dev_debug # remove trap. @@ -44,7 +44,7 @@ elif [ "${exitcode}" != "0" ]; then elif [ "${exitcode}" ] && [ "${exitcode}" == "0" ]; then # List LinuxGSM version in logs fn_script_log_info "LinuxGSM version: ${version}" - fn_script_log_pass "${functionselfname} exiting with code: ${exitcode}" + fn_script_log_pass "${moduleselfname} exiting with code: ${exitcode}" fn_exit_dev_debug # remove trap. trap - INT @@ -53,7 +53,7 @@ else # List LinuxGSM version in logs fn_script_log_info "LinuxGSM version: ${version}" fn_print_error "No exit code set" - fn_script_log_pass "${functionselfname} exiting with code: NOT SET" + fn_script_log_pass "${moduleselfname} exiting with code: NOT SET" fn_exit_dev_debug # remove trap. trap - INT diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index a1708008c..07a2ebd09 100755 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/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/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh old mode 100755 new mode 100644 index d7762b0ac..222ad0cf8 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: getopt arguments. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Define all commands here. ## User commands | Trigger commands | Description @@ -18,11 +18,11 @@ 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.") # Console servers only. cmd_console=("c;console" "command_console.sh" "Access server console.") @@ -54,7 +54,7 @@ cmd_dev_detect_deps=("dd;detect-deps" "command_dev_detect_deps.sh" "Detect requi 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.") +cmd_dev_clear_modules=("cf;clear-modules" "command_dev_clear_modules.sh" "Delete the contents of the modules dir.") ### Set specific opt here. @@ -145,7 +145,7 @@ currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}") ## Developer commands. currentopt+=("${cmd_dev_debug[@]}") if [ -f ".dev-debug" ]; then - currentopt+=("${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_functions[@]}") + currentopt+=("${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_modules[@]}") fi ## Sponsor. diff --git a/lgsm/functions/core_github.sh b/lgsm/functions/core_github.sh index 0462e65bf..228fe1078 100644 --- a/lgsm/functions/core_github.sh +++ b/lgsm/functions/core_github.sh @@ -1,11 +1,11 @@ #!/bin/bash -# LinuxGSM core_github.sh function +# LinuxGSM core_github.sh module # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: core function file for updates via github +# Description: core module file for updates via github -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" github_api="https://api.github.com" diff --git a/lgsm/functions/core_legacy.sh b/lgsm/functions/core_legacy.sh old mode 100755 new mode 100644 index f9aa51455..2ed942abd --- a/lgsm/functions/core_legacy.sh +++ b/lgsm/functions/core_legacy.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Code for backwards compatability with older versions of LinuxGSM. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # This is to help the transition to v20.3.0 and above legacy_versions_array=(v20.2.1 v20.2.0 v20.1.5 v20.1.4 v20.1.3 v20.1.2 v20.1.1 v20.1.0 v19.12.5 v19.12.4 v19.12.3 v19.12.2 v19.12.1 v19.12.0) @@ -78,6 +78,15 @@ if [ -z "${wsstartmap}" ]; then fi fi +# 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" +if [ -d "${lgsmdir}/functions" ]; then + if [ "$(find "${lgsmdir}/modules"/ -type f -mtime +"14" | wc -l)" -ne "0" ]; then + rm -rf "${lgsmdir:?}/functions" + fi +fi + fn_parms() { fn_reload_startparameters parms="${startparameters}" diff --git a/lgsm/functions/core_logs.sh b/lgsm/functions/core_logs.sh old mode 100755 new mode 100644 index 1f0e27540..8057f30f7 --- a/lgsm/functions/core_logs.sh +++ b/lgsm/functions/core_logs.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Acts as a log rotator, removing old logs. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Check if logfile variable and file exist, create logfile if it doesn't exist. if [ "${consolelog}" ]; then diff --git a/lgsm/functions/core_messages.sh b/lgsm/functions/core_messages.sh old mode 100755 new mode 100644 index 5362dd3d3..6d3ca9a25 --- a/lgsm/functions/core_messages.sh +++ b/lgsm/functions/core_messages.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Defines on-screen messages such as [ OK ] and how script logs look. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # nl: new line: message is following by a new line. # eol: end of line: message is placed at the end of the current line. diff --git a/lgsm/functions/core_modules.sh b/lgsm/functions/core_modules.sh new file mode 100644 index 000000000..8eb843b5a --- /dev/null +++ b/lgsm/functions/core_modules.sh @@ -0,0 +1,816 @@ +#!/bin/bash +# LinuxGSM core_modules.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Defines all modules to allow download and execution of modules using fn_fetch_module. +# This module is called first before any other module. Without this file other modules will not load. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +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_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_exit.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_steamcmd.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_console.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_sponsor.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_monitor.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_validate.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 +} + +install_squad_license.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_remove.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_restart.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_send.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Checks + +check.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_executable.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_last_update.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_root.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_system_dir.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_version.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Compress + +compress_unreal2_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_core.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Dev + +command_dev_clear_modules.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_glibc.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 +} + +# Fix + +fix.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_arma3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_armar.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_bt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_bo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_cmw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_csgo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_dst.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_hw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ins.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_kf.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_kf2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_lo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_mcb.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_mta.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_nmrih.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_onset.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ro.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_rust.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_rw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_sfc.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_st.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_steamcmd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_terraria.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_tf2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ut3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_rust.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_samp.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_sdtd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_sof2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_squad.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ts3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ut2k4.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ut.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_unt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_vh.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_wurm.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_zmr.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Info + +info_distro.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_stats.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Alert + +alert.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_ifttt.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_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_rocketchat.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 +} + +# Query + +query_gamedig.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Update + +command_update_modules.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_check_update.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_bedrock.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +update_papermc.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_jediknight2.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_ut99.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 +} + +install_complete.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_dst_token.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_gslt.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_retry.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_stats.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_ts3db.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_ut2k4_key.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Calls code required for legacy servers +core_legacy.sh + +# Creates tmp dir if missing +if [ ! -d "${tmpdir}" ]; then + mkdir -p "${tmpdir}" +fi + +# Creates lock dir if missing +if [ ! -d "${lockdir}" ]; then + mkdir -p "${lockdir}" +fi + +# Calls on-screen messages (bootstrap) +core_messages.sh + +#Calls file downloader (bootstrap) +core_dl.sh + +# Calls the global Ctrl-C trap +core_trap.sh diff --git a/lgsm/functions/core_steamcmd.sh b/lgsm/functions/core_steamcmd.sh old mode 100755 new mode 100644 index 119748fb7..78c30f60a --- a/lgsm/functions/core_steamcmd.sh +++ b/lgsm/functions/core_steamcmd.sh @@ -3,9 +3,9 @@ # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: Core functions for SteamCMD +# Description: Core modules for SteamCMD -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_steamcmd() { if [ "${shortname}" == "ark" ] && [ "${installsteamcmd}" == "1" ]; then diff --git a/lgsm/functions/core_trap.sh b/lgsm/functions/core_trap.sh old mode 100755 new mode 100644 index ae2b79470..ea6fce869 --- a/lgsm/functions/core_trap.sh +++ b/lgsm/functions/core_trap.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles CTRL-C trap to give an exit code. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_exit_trap() { if [ -z "${exitcode}" ]; then diff --git a/lgsm/functions/README.md b/lgsm/modules/README.md old mode 100755 new mode 100644 similarity index 100% rename from lgsm/functions/README.md rename to lgsm/modules/README.md diff --git a/lgsm/functions/alert.sh b/lgsm/modules/alert.sh old mode 100755 new mode 100644 similarity index 98% rename from lgsm/functions/alert.sh rename to lgsm/modules/alert.sh index 59deae2b6..c7ed897f9 --- a/lgsm/functions/alert.sh +++ b/lgsm/modules/alert.sh @@ -3,9 +3,9 @@ # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: Overall function for managing alerts. +# Description: Overall module for managing alerts. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Generates alert log of the details at the time of the alert. # Used with email alerts. diff --git a/lgsm/functions/alert_discord.sh b/lgsm/modules/alert_discord.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/alert_discord.sh rename to lgsm/modules/alert_discord.sh index 770817516..a384de3db --- a/lgsm/functions/alert_discord.sh +++ b/lgsm/modules/alert_discord.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Discord alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( cat << EOF diff --git a/lgsm/functions/alert_email.sh b/lgsm/modules/alert_email.sh old mode 100755 new mode 100644 similarity index 90% rename from lgsm/functions/alert_email.sh rename to lgsm/modules/alert_email.sh index ad90e880f..e2cf5f123 --- a/lgsm/functions/alert_email.sh +++ b/lgsm/modules/alert_email.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends email alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "Sending Email alert: ${email}" fn_sleep_time diff --git a/lgsm/functions/alert_gotify.sh b/lgsm/modules/alert_gotify.sh similarity index 93% rename from lgsm/functions/alert_gotify.sh rename to lgsm/modules/alert_gotify.sh index faeba4593..ef833ba75 100644 --- a/lgsm/functions/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/functions/alert_ifttt.sh b/lgsm/modules/alert_ifttt.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/alert_ifttt.sh rename to lgsm/modules/alert_ifttt.sh index f8bbc24ad..ae0de8ed6 --- a/lgsm/functions/alert_ifttt.sh +++ b/lgsm/modules/alert_ifttt.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends IFTTT alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( cat << EOF diff --git a/lgsm/functions/alert_mailgun.sh b/lgsm/modules/alert_mailgun.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/alert_mailgun.sh rename to lgsm/modules/alert_mailgun.sh index 25576209c..a25c82648 --- a/lgsm/functions/alert_mailgun.sh +++ b/lgsm/modules/alert_mailgun.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Mailgun Email alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${mailgunapiregion}" == "eu" ]; then mailgunapiurl="https://api.eu.mailgun.net" diff --git a/lgsm/functions/alert_pushbullet.sh b/lgsm/modules/alert_pushbullet.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/alert_pushbullet.sh rename to lgsm/modules/alert_pushbullet.sh index 3e82d0db0..eec141611 --- a/lgsm/functions/alert_pushbullet.sh +++ b/lgsm/modules/alert_pushbullet.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Pushbullet Messenger alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( cat << EOF diff --git a/lgsm/functions/alert_pushover.sh b/lgsm/modules/alert_pushover.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/alert_pushover.sh rename to lgsm/modules/alert_pushover.sh index d7c086478..608e73c30 --- a/lgsm/functions/alert_pushover.sh +++ b/lgsm/modules/alert_pushover.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Pushover alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "Sending Pushover alert" diff --git a/lgsm/functions/alert_rocketchat.sh b/lgsm/modules/alert_rocketchat.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/alert_rocketchat.sh rename to lgsm/modules/alert_rocketchat.sh index 34d018e38..875a6ff5d --- a/lgsm/functions/alert_rocketchat.sh +++ b/lgsm/modules/alert_rocketchat.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Rocketchat alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( cat << EOF diff --git a/lgsm/functions/alert_slack.sh b/lgsm/modules/alert_slack.sh old mode 100755 new mode 100644 similarity index 96% rename from lgsm/functions/alert_slack.sh rename to lgsm/modules/alert_slack.sh index 2e87c1571..3bb148828 --- a/lgsm/functions/alert_slack.sh +++ b/lgsm/modules/alert_slack.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Slack alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( cat << EOF diff --git a/lgsm/functions/alert_telegram.sh b/lgsm/modules/alert_telegram.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/alert_telegram.sh rename to lgsm/modules/alert_telegram.sh index 27e34beb4..77b89560c --- a/lgsm/functions/alert_telegram.sh +++ b/lgsm/modules/alert_telegram.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Telegram Messenger alert. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( cat << EOF diff --git a/lgsm/functions/check.sh b/lgsm/modules/check.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/check.sh rename to lgsm/modules/check.sh index 239a24140..f0f49fc51 --- a/lgsm/functions/check.sh +++ b/lgsm/modules/check.sh @@ -3,10 +3,10 @@ # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: Overall function for managing checks. +# Description: Overall module for managing checks. # Runs checks that will either halt on or fix an issue. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Every command that requires checks just references check.sh. # check.sh selects which checks to run by using arrays. diff --git a/lgsm/functions/check_config.sh b/lgsm/modules/check_config.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/check_config.sh rename to lgsm/modules/check_config.sh index 2c65243eb..4f96a8db4 --- a/lgsm/functions/check_config.sh +++ b/lgsm/modules/check_config.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if the server config is missing and warns the user if needed. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then fn_print_dots "" diff --git a/lgsm/functions/check_deps.sh b/lgsm/modules/check_deps.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/check_deps.sh rename to lgsm/modules/check_deps.sh index bb8507769..1db5c96c3 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/modules/check_deps.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks and installs missing dependencies. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_mono_repo() { if [ "${autodepinstall}" == "0" ]; then diff --git a/lgsm/functions/check_executable.sh b/lgsm/modules/check_executable.sh old mode 100755 new mode 100644 similarity index 89% rename from lgsm/functions/check_executable.sh rename to lgsm/modules/check_executable.sh index d1b5c3efd..40721fbf4 --- a/lgsm/functions/check_executable.sh +++ b/lgsm/modules/check_executable.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if server executable exists. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Check if executable exists execname=$(basename "${executable}") diff --git a/lgsm/functions/check_glibc.sh b/lgsm/modules/check_glibc.sh old mode 100755 new mode 100644 similarity index 92% rename from lgsm/functions/check_glibc.sh rename to lgsm/modules/check_glibc.sh index b1a959f5b..25357a461 --- a/lgsm/functions/check_glibc.sh +++ b/lgsm/modules/check_glibc.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if the server has the correct Glibc version. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_distro.sh diff --git a/lgsm/functions/check_ip.sh b/lgsm/modules/check_ip.sh old mode 100755 new mode 100644 similarity index 96% rename from lgsm/functions/check_ip.sh rename to lgsm/modules/check_ip.sh index 4b8eca5ec..8dc0567b9 --- a/lgsm/functions/check_ip.sh +++ b/lgsm/modules/check_ip.sh @@ -6,7 +6,7 @@ # Description: Automatically identifies the server interface IP. # If multiple interfaces are detected the user will need to manually set using ip="0.0.0.0". -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_game.sh diff --git a/lgsm/functions/check_last_update.sh b/lgsm/modules/check_last_update.sh old mode 100755 new mode 100644 similarity index 92% rename from lgsm/functions/check_last_update.sh rename to lgsm/modules/check_last_update.sh index ee86c0ba1..d4f2d8f89 --- a/lgsm/functions/check_last_update.sh +++ b/lgsm/modules/check_last_update.sh @@ -6,7 +6,7 @@ # Description: Checks lock file to see when last update happened. # Will reboot server if instance not rebooted since update. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -f "${lockdir}/${selfname}-laststart.lock" ]; then laststart=$(cat "${lockdir}/${selfname}-laststart.lock") diff --git a/lgsm/functions/check_logs.sh b/lgsm/modules/check_logs.sh old mode 100755 new mode 100644 similarity index 90% rename from lgsm/functions/check_logs.sh rename to lgsm/modules/check_logs.sh index fa3df92d1..2087ac915 --- a/lgsm/functions/check_logs.sh +++ b/lgsm/modules/check_logs.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if log files exist. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_check_logs() { fn_print_dots "Checking for log files" diff --git a/lgsm/functions/check_permissions.sh b/lgsm/modules/check_permissions.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/check_permissions.sh rename to lgsm/modules/check_permissions.sh index 0094456ec..bb3e6764f --- a/lgsm/functions/check_permissions.sh +++ b/lgsm/modules/check_permissions.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks ownership & permissions of scripts, files and directories. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_check_ownership() { if [ -f "${rootdir}/${selfname}" ]; then @@ -13,8 +13,8 @@ fn_check_ownership() { selfownissue=1 fi fi - if [ -d "${functionsdir}" ]; then - if [ "$(find "${functionsdir}" -not -user "$(whoami)" | wc -l)" -ne "0" ]; then + if [ -d "${modulesdir}" ]; then + if [ "$(find "${modulesdir}" -not -user "$(whoami)" | wc -l)" -ne "0" ]; then funcownissue=1 fi fi @@ -34,7 +34,7 @@ fn_check_ownership() { find "${rootdir}/${selfname}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n" fi if [ "${funcownissue}" == "1" ]; then - find "${functionsdir}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n" + find "${modulesdir}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n" fi if [ "${filesownissue}" == "1" ]; then find "${serverfiles}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n" @@ -53,15 +53,15 @@ fn_check_ownership() { } fn_check_permissions() { - if [ -d "${functionsdir}" ]; then - if [ "$(find "${functionsdir}" -type f -not -executable | wc -l)" -ne "0" ]; then + if [ -d "${modulesdir}" ]; then + if [ "$(find "${modulesdir}" -type f -not -executable | wc -l)" -ne "0" ]; then fn_print_fail_nl "Permissions issues found" fn_script_log_fatal "Permissions issues found" fn_print_information_nl "The following files are not executable:" fn_script_log_info "The following files are not executable:" { echo -e "File\n" - find "${functionsdir}" -type f -not -executable -printf "%p\n" + find "${modulesdir}" -type f -not -executable -printf "%p\n" } | column -s $'\t' -t | tee -a "${lgsmlog}" if [ "${monitorflag}" == 1 ]; then alert="permissions" @@ -141,7 +141,7 @@ fn_check_permissions() { fi } -## The following fn_sys_perm_* functions checks for permission errors in /sys directory. +## The following fn_sys_perm_* modules checks for permission errors in /sys directory. # Checks for permission errors in /sys directory. fn_sys_perm_errors_detect() { diff --git a/lgsm/functions/check_root.sh b/lgsm/modules/check_root.sh old mode 100755 new mode 100644 similarity index 89% rename from lgsm/functions/check_root.sh rename to lgsm/modules/check_root.sh index dab033148..26475601a --- a/lgsm/functions/check_root.sh +++ b/lgsm/modules/check_root.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if the user tried to run the script as root. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "$(whoami)" == "root" ] && [ ! -f /.dockerenv ]; then if [ "${commandname}" != "INSTALL" ]; then diff --git a/lgsm/functions/check_status.sh b/lgsm/modules/check_status.sh old mode 100755 new mode 100644 similarity index 82% rename from lgsm/functions/check_status.sh rename to lgsm/modules/check_status.sh index 28ec38eb2..2ebfb3055 --- a/lgsm/functions/check_status.sh +++ b/lgsm/modules/check_status.sh @@ -5,6 +5,6 @@ # Website: https://linuxgsm.com # Description: Checks the process status of the server. Either online or offline. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" status=$(tmux list-sessions -F "#{session_name}" 2> /dev/null | grep -Ecx "^${sessionname}") diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/modules/check_steamcmd.sh old mode 100755 new mode 100644 similarity index 82% rename from lgsm/functions/check_steamcmd.sh rename to lgsm/modules/check_steamcmd.sh index d41e8669f..5d14bb21f --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/modules/check_steamcmd.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Checks if SteamCMD is installed correctly. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -# init steamcmd functions +# init steamcmd functions. core_steamcmd.sh fn_check_steamcmd_clear diff --git a/lgsm/functions/check_system_dir.sh b/lgsm/modules/check_system_dir.sh old mode 100755 new mode 100644 similarity index 88% rename from lgsm/functions/check_system_dir.sh rename to lgsm/modules/check_system_dir.sh index 0a732d6d1..9f0f5f092 --- a/lgsm/functions/check_system_dir.sh +++ b/lgsm/modules/check_system_dir.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if systemdir/serverfiles is accessible. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${commandname}" != "VALIDATE" ]; then checkdir="${serverfiles}" diff --git a/lgsm/functions/check_system_requirements.sh b/lgsm/modules/check_system_requirements.sh old mode 100755 new mode 100644 similarity index 96% rename from lgsm/functions/check_system_requirements.sh rename to lgsm/modules/check_system_requirements.sh index bfe597135..114292f46 --- a/lgsm/functions/check_system_requirements.sh +++ b/lgsm/modules/check_system_requirements.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks RAM requirements. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_distro.sh diff --git a/lgsm/functions/check_tmuxception.sh b/lgsm/modules/check_tmuxception.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/check_tmuxception.sh rename to lgsm/modules/check_tmuxception.sh index 64705a3a8..aded5cb2d --- a/lgsm/functions/check_tmuxception.sh +++ b/lgsm/modules/check_tmuxception.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if run from tmux or screen. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_check_is_in_tmux() { if [ "${TMUX}" ]; then diff --git a/lgsm/functions/check_version.sh b/lgsm/modules/check_version.sh old mode 100755 new mode 100644 similarity index 91% rename from lgsm/functions/check_version.sh rename to lgsm/modules/check_version.sh index 657e32b54..3ca015843 --- a/lgsm/functions/check_version.sh +++ b/lgsm/modules/check_version.sh @@ -6,7 +6,7 @@ # Description: Will run update-lgsm if gameserver.sh and modules version does not match # this will allow gameserver.sh to update - useful for multi instance servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -n "${modulesversion}" ] && [ -n "${version}" ] && [ "${version}" != "${modulesversion}" ]; then exitbypass=1 diff --git a/lgsm/functions/command_backup.sh b/lgsm/modules/command_backup.sh similarity index 99% rename from lgsm/functions/command_backup.sh rename to lgsm/modules/command_backup.sh index d69c57a0f..1973eb95f 100644 --- a/lgsm/functions/command_backup.sh +++ b/lgsm/modules/command_backup.sh @@ -7,7 +7,7 @@ commandname="BACKUP" commandaction="Backing up" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/command_check_update.sh b/lgsm/modules/command_check_update.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/command_check_update.sh rename to lgsm/modules/command_check_update.sh index 3753c72c6..f079f3616 --- a/lgsm/functions/command_check_update.sh +++ b/lgsm/modules/command_check_update.sh @@ -7,7 +7,7 @@ commandname="CHECK-UPDATE" commandaction="check for Update" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_print_dots "" diff --git a/lgsm/functions/command_console.sh b/lgsm/modules/command_console.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/command_console.sh rename to lgsm/modules/command_console.sh index 5b84789e6..e95f2d0e5 --- a/lgsm/functions/command_console.sh +++ b/lgsm/modules/command_console.sh @@ -7,7 +7,7 @@ commandname="CONSOLE" commandaction="Access console" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/command_debug.sh b/lgsm/modules/command_debug.sh old mode 100755 new mode 100644 similarity index 98% rename from lgsm/functions/command_debug.sh rename to lgsm/modules/command_debug.sh index c6422be65..52efd04db --- a/lgsm/functions/command_debug.sh +++ b/lgsm/modules/command_debug.sh @@ -7,7 +7,7 @@ commandname="DEBUG" commandaction="Debuging" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set # Trap to remove lockfile on quit. diff --git a/lgsm/functions/command_details.sh b/lgsm/modules/command_details.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/command_details.sh rename to lgsm/modules/command_details.sh index 08d9f031b..2c8e3a658 --- a/lgsm/functions/command_details.sh +++ b/lgsm/modules/command_details.sh @@ -7,7 +7,7 @@ commandname="DETAILS" commandaction="Viewing details" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set # Run checks and gathers details to display. diff --git a/lgsm/functions/command_dev_clear_functions.sh b/lgsm/modules/command_dev_clear_modules.sh old mode 100755 new mode 100644 similarity index 60% rename from lgsm/functions/command_dev_clear_functions.sh rename to lgsm/modules/command_dev_clear_modules.sh index 87c77515d..52d07ee1a --- a/lgsm/functions/command_dev_clear_functions.sh +++ b/lgsm/modules/command_dev_clear_modules.sh @@ -1,21 +1,21 @@ #!/bin/bash -# LinuxGSM command_dev_clear_functions.sh module +# LinuxGSM command_dev_clear_modules.sh module # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: Deletes the contents of the functions dir. +# Description: Deletes the contents of the modules dir. commandname="DEV-CLEAR-MODULES" commandaction="Clearing modules" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set echo -e "=================================" -echo -e "Clear Functions" +echo -e "Clear Modules" echo -e "=================================" echo -e "" -if fn_prompt_yn "Do you want to delete all functions?" Y; then - rm -rfv "${functionsdir:?}/"* +if fn_prompt_yn "Do you want to delete all modules?" Y; then + rm -rfv "${modulesdir:?}/"* rm -rfv "${configdirdefault:?}/"* fn_script_log_info "Cleared modules directory" fn_script_log_info "Cleared default config directory" diff --git a/lgsm/functions/command_dev_debug.sh b/lgsm/modules/command_dev_debug.sh old mode 100755 new mode 100644 similarity index 89% rename from lgsm/functions/command_dev_debug.sh rename to lgsm/modules/command_dev_debug.sh index 19f16d58e..081bda611 --- a/lgsm/functions/command_dev_debug.sh +++ b/lgsm/modules/command_dev_debug.sh @@ -7,7 +7,7 @@ commandname="DEV-DEBUG" commandaction="Developer debug" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_reset if [ -f "${rootdir}/.dev-debug" ]; then diff --git a/lgsm/functions/command_dev_detect_deps.sh b/lgsm/modules/command_dev_detect_deps.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/command_dev_detect_deps.sh rename to lgsm/modules/command_dev_detect_deps.sh index d16b74418..763ab5554 --- a/lgsm/functions/command_dev_detect_deps.sh +++ b/lgsm/modules/command_dev_detect_deps.sh @@ -7,7 +7,7 @@ commandname="DEV-DETECT-DEPS" commandaction="Developer detect deps" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set echo -e "=================================" diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/modules/command_dev_detect_glibc.sh old mode 100755 new mode 100644 similarity index 97% rename from lgsm/functions/command_dev_detect_glibc.sh rename to lgsm/modules/command_dev_detect_glibc.sh index 73280e55d..8ff87d711 --- a/lgsm/functions/command_dev_detect_glibc.sh +++ b/lgsm/modules/command_dev_detect_glibc.sh @@ -8,7 +8,7 @@ commandname="DEV-DETECT-GLIBC" commandaction="Developer detect glibc" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set echo -e "=================================" diff --git a/lgsm/functions/command_dev_detect_ldd.sh b/lgsm/modules/command_dev_detect_ldd.sh old mode 100755 new mode 100644 similarity index 96% rename from lgsm/functions/command_dev_detect_ldd.sh rename to lgsm/modules/command_dev_detect_ldd.sh index 43630d4e9..877c8d95b --- a/lgsm/functions/command_dev_detect_ldd.sh +++ b/lgsm/modules/command_dev_detect_ldd.sh @@ -8,7 +8,7 @@ commandname="DEV-DETECT-LDD" commandaction="Developer detect ldd" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set echo -e "=================================" diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/modules/command_dev_query_raw.sh old mode 100755 new mode 100644 similarity index 97% rename from lgsm/functions/command_dev_query_raw.sh rename to lgsm/modules/command_dev_query_raw.sh index 26884b259..0d30e75bf --- a/lgsm/functions/command_dev_query_raw.sh +++ b/lgsm/modules/command_dev_query_raw.sh @@ -7,7 +7,7 @@ commandname="DEV-QUERY-RAW" commandaction="Developer query raw" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh @@ -229,10 +229,10 @@ echo -e "" for queryip in "${queryips[@]}"; do echo -e "./query_gsquery.py -a \"${queryip}\" -p \"${queryport}\" -e \"${querytype}\"" echo -e "" - if [ ! -f "${functionsdir}/query_gsquery.py" ]; then - fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nohash" + if [ ! -f "${modulesdir}/query_gsquery.py" ]; then + fn_fetch_file_github "lgsm/modules" "query_gsquery.py" "${modulesdir}" "chmodx" "norun" "noforce" "nohash" fi - "${functionsdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}" + "${modulesdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}" done echo -e "" echo -e "${lightgreen}TCP Raw Output${default}" diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/modules/command_fastdl.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/command_fastdl.sh rename to lgsm/modules/command_fastdl.sh index 78abd650a..4aff9994d --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/modules/command_fastdl.sh @@ -7,7 +7,7 @@ commandname="FASTDL" commandaction="Fastdl" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/command_install.sh b/lgsm/modules/command_install.sh old mode 100755 new mode 100644 similarity index 90% rename from lgsm/functions/command_install.sh rename to lgsm/modules/command_install.sh index 19dc59c7e..32f846fac --- a/lgsm/functions/command_install.sh +++ b/lgsm/modules/command_install.sh @@ -3,11 +3,11 @@ # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: Overall function for the installer. +# Description: Overall module for the installer. commandname="INSTALL" commandaction="Installing" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/command_install_resources_mta.sh b/lgsm/modules/command_install_resources_mta.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/command_install_resources_mta.sh rename to lgsm/modules/command_install_resources_mta.sh index daf039551..c3d745a30 --- a/lgsm/functions/command_install_resources_mta.sh +++ b/lgsm/modules/command_install_resources_mta.sh @@ -7,7 +7,7 @@ commandname="DEFAULT-RESOURCES" commandaction="Default Resources" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_install_resources() { diff --git a/lgsm/functions/command_mods_install.sh b/lgsm/modules/command_mods_install.sh old mode 100755 new mode 100644 similarity index 98% rename from lgsm/functions/command_mods_install.sh rename to lgsm/modules/command_mods_install.sh index 0edbe5bc0..d602be2cd --- a/lgsm/functions/command_mods_install.sh +++ b/lgsm/modules/command_mods_install.sh @@ -7,7 +7,7 @@ commandname="MODS-INSTALL" commandaction="Installing mods" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/modules/command_mods_remove.sh old mode 100755 new mode 100644 similarity index 98% rename from lgsm/functions/command_mods_remove.sh rename to lgsm/modules/command_mods_remove.sh index 7127dcb3c..08095c8e8 --- a/lgsm/functions/command_mods_remove.sh +++ b/lgsm/modules/command_mods_remove.sh @@ -7,7 +7,7 @@ commandname="MODS-REMOVE" commandaction="Removing mods" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/command_mods_update.sh b/lgsm/modules/command_mods_update.sh old mode 100755 new mode 100644 similarity index 98% rename from lgsm/functions/command_mods_update.sh rename to lgsm/modules/command_mods_update.sh index 80b23fea9..b917f191f --- a/lgsm/functions/command_mods_update.sh +++ b/lgsm/modules/command_mods_update.sh @@ -7,7 +7,7 @@ commandname="MODS-UPDATE" commandaction="Updating mods" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/command_monitor.sh b/lgsm/modules/command_monitor.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/command_monitor.sh rename to lgsm/modules/command_monitor.sh index 20c830e0b..f2db9ca2d --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/modules/command_monitor.sh @@ -8,7 +8,7 @@ commandname="MONITOR" commandaction="Monitoring" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_monitor_check_lockfile() { @@ -84,10 +84,10 @@ fn_monitor_check_queryport() { } fn_query_gsquery() { - if [ ! -f "${functionsdir}/query_gsquery.py" ]; then - fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nohash" + if [ ! -f "${modulesdir}/query_gsquery.py" ]; then + fn_fetch_file_github "lgsm/modules" "query_gsquery.py" "${modulesdir}" "chmodx" "norun" "noforce" "nohash" fi - "${functionsdir}"/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="$?" } diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/modules/command_postdetails.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/command_postdetails.sh rename to lgsm/modules/command_postdetails.sh index dad44d9af..736c9ec27 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/modules/command_postdetails.sh @@ -7,12 +7,12 @@ commandname="POST-DETAILS" commandaction="Posting details" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set posttarget="https://termbin.com" -# source all of the functions defined in the details command. +# source all of the modules defined in the details command. info_messages.sh fn_bad_postdetailslog() { diff --git a/lgsm/functions/command_restart.sh b/lgsm/modules/command_restart.sh old mode 100755 new mode 100644 similarity index 83% rename from lgsm/functions/command_restart.sh rename to lgsm/modules/command_restart.sh index 3bf60c32c..b7bb1f3e3 --- a/lgsm/functions/command_restart.sh +++ b/lgsm/modules/command_restart.sh @@ -7,7 +7,7 @@ commandname="MODS-INSTALL" commandaction="Restarting" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set info_game.sh diff --git a/lgsm/functions/command_send.sh b/lgsm/modules/command_send.sh similarity index 93% rename from lgsm/functions/command_send.sh rename to lgsm/modules/command_send.sh index c143276f6..8ba8f8412 100644 --- a/lgsm/functions/command_send.sh +++ b/lgsm/modules/command_send.sh @@ -7,7 +7,7 @@ commandname="SEND" commandaction="Send" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/command_skeleton.sh b/lgsm/modules/command_skeleton.sh similarity index 91% rename from lgsm/functions/command_skeleton.sh rename to lgsm/modules/command_skeleton.sh index 53c4ddec5..01a7f4e7e 100644 --- a/lgsm/functions/command_skeleton.sh +++ b/lgsm/modules/command_skeleton.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Creates an copy of a game servers directorys. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "Creating skeleton directory" check.sh diff --git a/lgsm/functions/command_sponsor.sh b/lgsm/modules/command_sponsor.sh old mode 100755 new mode 100644 similarity index 91% rename from lgsm/functions/command_sponsor.sh rename to lgsm/modules/command_sponsor.sh index 22ec0c49e..336f20f0a --- a/lgsm/functions/command_sponsor.sh +++ b/lgsm/modules/command_sponsor.sh @@ -7,7 +7,7 @@ commandname="SPONSOR" commandaction="Sponsor" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_print_ascii_logo diff --git a/lgsm/functions/command_start.sh b/lgsm/modules/command_start.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/command_start.sh rename to lgsm/modules/command_start.sh index 04c6b4e64..e5021cde2 --- a/lgsm/functions/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -7,7 +7,7 @@ commandname="START" commandaction="Starting" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" addtimestamp="gawk '{ print strftime(\\\"[$logtimestampformat]\\\"), \\\$0 }'" fn_firstcommand_set diff --git a/lgsm/functions/command_stop.sh b/lgsm/modules/command_stop.sh similarity index 99% rename from lgsm/functions/command_stop.sh rename to lgsm/modules/command_stop.sh index d18ef7c23..564f5ed4c 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/modules/command_stop.sh @@ -7,7 +7,7 @@ commandname="STOP" commandaction="Stopping" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set # Attempts graceful shutdown by sending 'CTRL+c'. diff --git a/lgsm/functions/command_test_alert.sh b/lgsm/modules/command_test_alert.sh old mode 100755 new mode 100644 similarity index 83% rename from lgsm/functions/command_test_alert.sh rename to lgsm/modules/command_test_alert.sh index 7fe61e48a..15f481391 --- a/lgsm/functions/command_test_alert.sh +++ b/lgsm/modules/command_test_alert.sh @@ -7,7 +7,7 @@ commandname="TEST-ALERT" commandaction="Sending Alert" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_print_dots "${servername}" diff --git a/lgsm/functions/command_ts3_server_pass.sh b/lgsm/modules/command_ts3_server_pass.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/command_ts3_server_pass.sh rename to lgsm/modules/command_ts3_server_pass.sh index be0816d15..4814ab142 --- a/lgsm/functions/command_ts3_server_pass.sh +++ b/lgsm/modules/command_ts3_server_pass.sh @@ -7,7 +7,7 @@ commandname="CHANGE-PASSWORD" commandaction="Changing password" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_serveradmin_password_prompt() { diff --git a/lgsm/functions/command_update.sh b/lgsm/modules/command_update.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/command_update.sh rename to lgsm/modules/command_update.sh index ae5c2065c..5993609c0 --- a/lgsm/functions/command_update.sh +++ b/lgsm/modules/command_update.sh @@ -7,7 +7,7 @@ commandname="UPDATE" commandaction="Updating" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_print_dots "" diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/modules/command_update_linuxgsm.sh old mode 100755 new mode 100644 similarity index 86% rename from lgsm/functions/command_update_linuxgsm.sh rename to lgsm/modules/command_update_linuxgsm.sh index 569bc7cdb..3c4e6d080 --- a/lgsm/functions/command_update_linuxgsm.sh +++ b/lgsm/modules/command_update_linuxgsm.sh @@ -3,11 +3,11 @@ # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. +# Description: Deletes the modules dir to allow re-downloading of modules from GitHub. commandname="UPDATE-LGSM" commandaction="Updating LinuxGSM" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh @@ -180,49 +180,49 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then fi fi # Check and update modules. -if [ -n "${functionsdir}" ]; then - if [ -d "${functionsdir}" ]; then +if [ -n "${modulesdir}" ]; then + if [ -d "${modulesdir}" ]; 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 fi done @@ -230,7 +230,7 @@ if [ -n "${functionsdir}" ]; then fi fi -fn_print_ok_nl "Updating functions" -fn_script_log_pass "Updating functions" +fn_print_ok_nl "Updating modules" +fn_script_log_pass "Updating modules" core_exit.sh diff --git a/lgsm/functions/command_validate.sh b/lgsm/modules/command_validate.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/command_validate.sh rename to lgsm/modules/command_validate.sh index 15257a3e2..23ee92a26 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/modules/command_validate.sh @@ -7,7 +7,7 @@ commandname="VALIDATE" commandaction="Validating" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_validate() { diff --git a/lgsm/functions/command_wipe.sh b/lgsm/modules/command_wipe.sh old mode 100755 new mode 100644 similarity index 98% rename from lgsm/functions/command_wipe.sh rename to lgsm/modules/command_wipe.sh index e1677e827..193d2cd2d --- a/lgsm/functions/command_wipe.sh +++ b/lgsm/modules/command_wipe.sh @@ -7,7 +7,7 @@ commandname="WIPE" commandaction="Wiping" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set # Provides an exit code upon error. diff --git a/lgsm/functions/compress_unreal2_maps.sh b/lgsm/modules/compress_unreal2_maps.sh old mode 100755 new mode 100644 similarity index 92% rename from lgsm/functions/compress_unreal2_maps.sh rename to lgsm/modules/compress_unreal2_maps.sh index 0c32d3c77..f67ac7010 --- a/lgsm/functions/compress_unreal2_maps.sh +++ b/lgsm/modules/compress_unreal2_maps.sh @@ -7,7 +7,7 @@ commandname="MAP-COMPRESSOR" commandaction="Compressing maps" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/functions/compress_ut99_maps.sh b/lgsm/modules/compress_ut99_maps.sh old mode 100755 new mode 100644 similarity index 92% rename from lgsm/functions/compress_ut99_maps.sh rename to lgsm/modules/compress_ut99_maps.sh index 9aa074ba9..51bbd386a --- a/lgsm/functions/compress_ut99_maps.sh +++ b/lgsm/modules/compress_ut99_maps.sh @@ -7,7 +7,7 @@ commandname="MAP-COMPRESSOR" commandaction="Compressing maps" -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh diff --git a/lgsm/modules/core_dl.sh b/lgsm/modules/core_dl.sh new file mode 100644 index 000000000..405e9dc6b --- /dev/null +++ b/lgsm/modules/core_dl.sh @@ -0,0 +1,627 @@ +#!/bin/bash +# LinuxGSM core_dl.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Deals with all downloads for LinuxGSM. + +# remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2 +# local_filedir: location the file is to be saved: /home/server/lgsm/tmp +# local_filename: name of file (this can be different from the url name): file.tar.bz2 +# chmodx: Optional, set to "chmodx" to make file executable using chmod +x +# run: Optional, set run to execute the file after download +# forcedl: Optional, force re-download of file even if exists +# hash: Optional, set an hash sum and will compare it against the file. +# +# Downloads can be defined in code like so: +# fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" +# fn_fetch_file "http://example.com/file.tar.bz2" "http://example.com/file2.tar.bz2" "file.tar.bz2" "file2.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd" + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +fn_dl_steamcmd() { + fn_print_start_nl "${remotelocation}" + fn_script_log_info "${commandaction} ${selfname}: ${remotelocation}" + if [ -n "${branch}" ]; then + echo -e "Branch: ${branch}" + fn_script_log_info "Branch: ${branch}" + fi + if [ -n "${betapassword}" ]; then + echo -e "Branch password: ${betapassword}" + fn_script_log_info "Branch password: ${betapassword}" + fi + if [ -d "${steamcmddir}" ]; then + cd "${steamcmddir}" || exit + fi + + # Unbuffer will allow the output of steamcmd not buffer allowing a smooth output. + # unbuffer us part of the expect package. + if [ "$(command -v unbuffer)" ]; then + unbuffer="unbuffer" + fi + + # Validate will be added as a parameter if required. + if [ "${commandname}" == "VALIDATE" ] || [ "${commandname}" == "INSTALL" ]; then + validate="validate" + fi + + # To do error checking for SteamCMD the output of steamcmd will be saved to a log. + steamcmdlog="${lgsmlogdir}/${selfname}-steamcmd.log" + + # clear previous steamcmd log + if [ -f "${steamcmdlog}" ]; then + rm -f "${steamcmdlog:?}" + fi + counter=0 + while [ "${counter}" == "0" ] || [ "${exitcode}" != "0" ]; do + counter=$((counter + 1)) + # Select SteamCMD parameters + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. + if [ "${appid}" == "90" ]; then + # If using a specific branch. + if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then + ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + elif [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + else + ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + fi + # Force Windows Platform type. + elif [ "${steamcmdforcewindows}" == "yes" ]; then + if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then + ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + elif [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + else + ${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + fi + # All other servers. + else + if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then + ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + elif [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + else + ${unbuffer} ${steamcmdcommand} +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}" + fi + fi + + # Error checking for SteamCMD. Some errors will loop to try again and some will just exit. + # Check also if we have more errors than retries to be sure that we do not loop to many times and error out. + exitcode=$? + if [ -n "$(grep -i "Error!" "${steamcmdlog}" | tail -1)" ] && [ "$(grep -ic "Error!" "${steamcmdlog}")" -ge "${counter}" ]; then + # Not enough space. + if [ -n "$(grep "0x202" "${steamcmdlog}" | tail -1)" ]; then + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" + core_exit.sh + # Not enough space. + elif [ -n "$(grep "0x212" "${steamcmdlog}" | tail -1)" ]; then + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Not enough disk space to download server files" + core_exit.sh + # Need tp purchase game. + elif [ -n "$(grep "No subscription" "${steamcmdlog}" | tail -1)" ]; then + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Steam account does not have a license for the required game" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Steam account does not have a license for the required game" + core_exit.sh + # Two-factor authentication failure + elif [ -n "$(grep "Two-factor code mismatch" "${steamcmdlog}" | tail -1)" ]; then + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Two-factor authentication failure" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Two-factor authentication failure" + core_exit.sh + # Incorrect Branch password + elif [ -n "$(grep "Password check for AppId" "${steamcmdlog}" | tail -1)" ]; then + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect" + core_exit.sh + # Update did not finish. + elif [ -n "$(grep "0x402" "${steamcmdlog}" | tail -1)" ] || [ -n "$(grep "0x602" "${steamcmdlog}" | tail -1)" ]; then + fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Update required but not completed - check network" + fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Update required but not completed - check network" + else + fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured" + echo -en "Please provide content log to LinuxGSM developers https://linuxgsm.com/steamcmd-error" + fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured" + fi + elif [ "${exitcode}" != 0 ]; then + fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}" + fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}" + else + fn_print_complete_nl "${commandaction} ${selfname}: ${remotelocation}" + fn_script_log_pass "${commandaction} ${selfname}: ${remotelocation}" + fi + + if [ "${counter}" -gt "10" ]; then + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Did not complete the download, too many retrys" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Did not complete the download, too many retrys" + core_exit.sh + fi + done +} + +# Emptys contents of the LinuxGSM tmpdir. +fn_clear_tmp() { + echo -en "clearing LinuxGSM tmp directory..." + if [ -d "${tmpdir}" ]; then + rm -rf "${tmpdir:?}/"* + local exitcode=$? + if [ "${exitcode}" != 0 ]; then + fn_print_error_eol_nl + fn_script_log_error "clearing LinuxGSM tmp directory" + else + fn_print_ok_eol_nl + fn_script_log_pass "clearing LinuxGSM tmp directory" + fi + fi +} + +fn_dl_hash() { + # Runs Hash Check if available. + if [ "${hash}" != "0" ] && [ "${hash}" != "nohash" ] && [ "${hash}" != "nomd5" ]; then + # MD5 + if [ "${#hash}" == "32" ]; then + hashbin="md5sum" + hashtype="MD5" + # SHA1 + elif [ "${#hash}" == "40" ]; then + hashbin="sha1sum" + hashtype="SHA1" + # SHA256 + elif [ "${#hash}" == "64" ]; then + hashbin="sha256sum" + hashtype="SHA256" + # SHA512 + elif [ "${#hash}" == "128" ]; then + hashbin="sha512sum" + hashtype="SHA512" + else + fn_script_log_error "hash lengh not known for hash type" + fn_print_error_nl "hash lengh not known for hash type" + core_exit.sh + fi + echo -en "verifying ${local_filename} with ${hashtype}..." + fn_sleep_time + hashsumcmd=$(${hashbin} "${local_filedir}/${local_filename}" | awk '{print $1}') + if [ "${hashsumcmd}" != "${hash}" ]; then + fn_print_fail_eol_nl + echo -e "${local_filename} returned ${hashtype} checksum: ${hashsumcmd}" + echo -e "expected ${hashtype} checksum: ${hash}" + fn_script_log_fatal "Verifying ${local_filename} with ${hashtype}" + fn_script_log_info "${local_filename} returned ${hashtype} checksum: ${hashsumcmd}" + fn_script_log_info "Expected ${hashtype} checksum: ${hash}" + core_exit.sh + else + fn_print_ok_eol_nl + fn_script_log_pass "Verifying ${local_filename} with ${hashtype}" + fn_script_log_info "${local_filename} returned ${hashtype} checksum: ${hashsumcmd}" + fn_script_log_info "Expected ${hashtype} checksum: ${hash}" + fi + fi +} + +# Extracts bzip2, gzip or zip files. +# Extracts can be defined in code like so: +# fn_dl_extract "${local_filedir}" "${local_filename}" "${extractdest}" "${extractsrc}" +# fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles" +fn_dl_extract() { + local_filedir="${1}" + local_filename="${2}" + extractdest="${3}" + extractsrc="${4}" + # Extracts archives. + echo -en "extracting ${local_filename}..." + + if [ ! -d "${extractdest}" ]; then + mkdir "${extractdest}" + fi + if [ ! -f "${local_filedir}/${local_filename}" ]; then + fn_print_fail_eol_nl + echo -en "file ${local_filedir}/${local_filename} not found" + fn_script_log_fatal "Extracting ${local_filename}" + fn_script_log_fatal "File ${local_filedir}/${local_filename} not found" + core_exit.sh + fi + mime=$(file -b --mime-type "${local_filedir}/${local_filename}") + if [ "${mime}" == "application/gzip" ] || [ "${mime}" == "application/x-gzip" ]; then + if [ -n "${extractsrc}" ]; then + extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdest}" --strip-components=1 "${extractsrc}") + else + extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdest}") + fi + elif [ "${mime}" == "application/x-bzip2" ]; then + if [ -n "${extractsrc}" ]; then + extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdest}" --strip-components=1 "${extractsrc}") + else + extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdest}") + fi + elif [ "${mime}" == "application/x-xz" ]; then + if [ -n "${extractsrc}" ]; then + extractcmd=$(tar -Jxf "${local_filedir}/${local_filename}" -C "${extractdest}" --strip-components=1 "${extractsrc}") + else + extractcmd=$(tar -Jxf "${local_filedir}/${local_filename}" -C "${extractdest}") + fi + elif [ "${mime}" == "application/zip" ]; then + if [ -n "${extractsrc}" ]; then + extractcmd=$(unzip -qoj -d "${extractdest}" "${local_filedir}/${local_filename}" "${extractsrc}"/*) + else + extractcmd=$(unzip -qo -d "${extractdest}" "${local_filedir}/${local_filename}") + fi + fi + local exitcode=$? + if [ "${exitcode}" != 0 ]; then + fn_print_fail_eol_nl + fn_script_log_fatal "Extracting ${local_filename}" + if [ -f "${lgsmlog}" ]; then + echo -e "${extractcmd}" >> "${lgsmlog}" + fi + echo -e "${extractcmd}" + core_exit.sh + else + fn_print_ok_eol_nl + fn_script_log_pass "Extracting ${local_filename}" + fi +} + +# Trap to remove file download if canceled before completed. +fn_fetch_trap() { + echo -e "" + echo -en "downloading ${local_filename}..." + fn_print_canceled_eol_nl + fn_script_log_info "Downloading ${local_filename}...CANCELED" + fn_sleep_time + rm -f "${local_filedir:?}/${local_filename}" + echo -en "downloading ${local_filename}..." + fn_print_removed_eol_nl + fn_script_log_info "Downloading ${local_filename}...REMOVED" + core_exit.sh +} + +# Will check a file exists and download it. Will not exit if fails to download. +fn_check_file() { + remote_fileurl="${1}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + remote_filename="${5}" + # If backup fileurl exists include it. + if [ -n "${remote_fileurl_backup}" ]; then + # counter set to 0 to allow second try + counter=0 + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) + else + # counter set to 1 to not allow second try + counter=1 + remote_fileurls_array=(remote_fileurl) + fi + for remote_fileurl_array in "${remote_fileurls_array[@]}"; do + if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then + fileurl="${remote_fileurl}" + fileurl_name="${remote_fileurl_name}" + elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then + fileurl="${remote_fileurl_backup}" + fileurl_name="${remote_fileurl_backup_name}" + fi + counter=$((counter + 1)) + echo -en "checking ${fileurl_name} ${remote_filename}...\c" + curlcmd=$(curl --output /dev/null --silent --head --fail "${fileurl}" 2>&1) + local exitcode=$? + + # On first try will error. On second try will fail. + if [ "${exitcode}" != 0 ]; then + if [ ${counter} -ge 2 ]; then + fn_print_fail_eol_nl + if [ -f "${lgsmlog}" ]; then + fn_script_log_fatal "Checking ${remote_filename}" + fn_script_log_fatal "${fileurl}" + checkflag=1 + fi + else + fn_print_error_eol_nl + if [ -f "${lgsmlog}" ]; then + fn_script_log_error "Checking ${remote_filename}" + fn_script_log_error "${fileurl}" + checkflag=2 + fi + fi + else + fn_print_ok_eol + echo -en "\033[2K\\r" + if [ -f "${lgsmlog}" ]; then + fn_script_log_pass "Checking ${remote_filename}" + checkflag=0 + fi + break + fi + done + + if [ -f "${local_filedir}/${local_filename}" ]; then + fn_dl_hash + # Execute file if run is set. + if [ "${run}" == "run" ]; then + # shellcheck source=/dev/null + source "${local_filedir}/${local_filename}" + fi + fi +} + +fn_fetch_file() { + remote_fileurl="${1}" + remote_fileurl_backup="${2}" + remote_fileurl_name="${3}" + remote_fileurl_backup_name="${4}" + local_filedir="${5}" + local_filename="${6}" + chmodx="${7:-0}" + run="${8:-0}" + forcedl="${9:-0}" + hash="${10:-0}" + + # Download file if missing or download forced. + if [ ! -f "${local_filedir}/${local_filename}" ] || [ "${forcedl}" == "forcedl" ]; then + # If backup fileurl exists include it. + if [ -n "${remote_fileurl_backup}" ]; then + # counter set to 0 to allow second try + counter=0 + remote_fileurls_array=(remote_fileurl remote_fileurl_backup) + else + # counter set to 1 to not allow second try + counter=1 + remote_fileurls_array=(remote_fileurl) + fi + for remote_fileurl_array in "${remote_fileurls_array[@]}"; do + if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then + fileurl="${remote_fileurl}" + fileurl_name="${remote_fileurl_name}" + elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then + fileurl="${remote_fileurl_backup}" + fileurl_name="${remote_fileurl_backup_name}" + fi + counter=$((counter + 1)) + if [ ! -d "${local_filedir}" ]; then + mkdir -p "${local_filedir}" + fi + # Trap will remove part downloaded files if canceled. + trap fn_fetch_trap INT + curlcmd=(curl --connect-timeout 10 --fail -L -o "${local_filedir}/${local_filename}" --retry 2) + + # if is large file show progress, else be silent + local exitcode="" + large_files=("bz2" "gz" "zip" "jar" "xz") + if grep -qE "(^|\s)${local_filename##*.}(\s|$)" <<< "${large_files[@]}"; then + echo -en "downloading ${local_filename}..." + fn_sleep_time + echo -en "\033[1K" + "${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1 + exitcode="$?" + else + echo -en "fetching ${fileurl_name} ${local_filename}...\c" + "${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1 + exitcode="$?" + fi + + # Download will fail if downloads a html file. + if [ -f "${local_filedir}/${local_filename}" ]; then + if head -n 1 "${local_filedir}/${local_filename}" | grep -q "DOCTYPE"; then + rm "${local_filedir:?}/${local_filename:?}" + local exitcode=2 + fi + fi + + # On first try will error. On second try will fail. + if [ "${exitcode}" != 0 ]; then + if [ ${counter} -ge 2 ]; then + fn_print_fail_eol_nl + if [ -f "${lgsmlog}" ]; then + fn_script_log_fatal "Downloading ${local_filename}..." + fn_script_log_fatal "${fileurl}" + fi + core_exit.sh + else + fn_print_error_eol_nl + if [ -f "${lgsmlog}" ]; then + fn_script_log_error "Downloading ${local_filename}..." + fn_script_log_error "${fileurl}" + fi + fi + else + fn_print_ok_eol_nl + if [ -f "${lgsmlog}" ]; then + fn_script_log_pass "Downloading ${local_filename}..." + fi + + # Make file executable if chmodx is set. + if [ "${chmodx}" == "chmodx" ]; then + chmod +x "${local_filedir}/${local_filename}" + fi + + # Remove trap. + trap - INT + + break + fi + done + fi + + if [ -f "${local_filedir}/${local_filename}" ]; then + fn_dl_hash + # Execute file if run is set. + if [ "${run}" == "run" ]; then + # shellcheck source=/dev/null + source "${local_filedir}/${local_filename}" + fi + fi +} + +# GitHub file download modules. +# Used to simplify downloading specific files from GitHub. + +# 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 +# local_filedir: location the file is to be saved: /home/server/lgsm/tmp +# local_filename: name of file (this can be different from the url name): file.tar.bz2 +# chmodx: Optional, set to "chmodx" to make file executable using chmod +x +# run: Optional, set run to execute the file after download +# forcedl: Optional, force re-download of file even if exists +# hash: Optional, set an hash sum and will compare it against the file. + +# Fetches files from the Git repo. +fn_fetch_file_github() { + 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_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_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_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_file_url_name}" + chmodx="${4:-0}" + run="${5:-0}" + forcedl="${6:-0}" + hash="${7:-0}" + # Passes vars to the file download module. + fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" +} + +fn_check_file_github() { + 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_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_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_file_url_name}" +} + +# Fetches config files from the Git repo. +fn_fetch_config() { + 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_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_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="${4}" + chmodx="nochmodx" + run="norun" + forcedl="noforce" + hash="nohash" + # Passes vars to the file download module. + fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" +} + +# Fetches modules from the Git repo during first download. +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 + 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_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_file_url_name}" + chmodx="chmodx" + run="run" + forcedl="noforce" + hash="nohash" + # Passes vars to the file download module. + fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" +} + +# Fetches modules from the Git repo during update-lgsm. +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_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_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_file_url_name}" + chmodx="chmodx" + run="norun" + forcedl="noforce" + hash="nohash" + # Passes vars to the file download module. + fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}" + +} + +# Function to download latest github release. +# $1 GitHub user / organisation. +# $2 Repo name. +# $3 Destination for download. +# $4 Search string in releases (needed if there are more files that can be downloaded from the release pages). +fn_dl_latest_release_github() { + local githubreleaseuser="${1}" + local githubreleaserepo="${2}" + local githubreleasedownloadpath="${3}" + local githubreleasesearch="${4}" + local githublatestreleaseurl="https://api.github.com/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest" + + # Get last github release. + # If no search for the release filename is set, just get the first file from the latest release. + if [ -z "${githubreleasesearch}" ]; then + githubreleaseassets=$(curl -s "${githublatestreleaseurl}" | jq '[ .assets[] ]') + else + githubreleaseassets=$(curl -s "${githublatestreleaseurl}" | jq "[ .assets[]|select(.browser_download_url | contains(\"${githubreleasesearch}\")) ]") + fi + + # Check how many releases we got from the api and exit if we have more then one. + if [ "$(echo -e "${githubreleaseassets}" | jq '. | length')" -gt 1 ]; then + fn_print_fatal_nl "Found more than one release to download - Please report this to the LinuxGSM issue tracker" + fn_script_log_fatal "Found more than one release to download - Please report this to the LinuxGSM issue tracker" + else + # Set variables for download via fn_fetch_file. + githubreleasefilename=$(echo -e "${githubreleaseassets}" | jq -r '.[]name') + githubreleasedownloadlink=$(echo -e "${githubreleaseassets}" | jq -r '.[]browser_download_url') + + # Error if no version is there. + if [ -z "${githubreleasefilename}" ]; then + fn_print_fail_nl "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}" + fn_script_log_fatal "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}" + else + # Fetch file from the remote location from the existing module to the ${tmpdir} for now. + fn_fetch_file "${githubreleasedownloadlink}" "" "${githubreleasefilename}" "" "${githubreleasedownloadpath}" "${githubreleasefilename}" + fi + fi +} diff --git a/lgsm/modules/core_exit.sh b/lgsm/modules/core_exit.sh new file mode 100644 index 000000000..a8686c2a8 --- /dev/null +++ b/lgsm/modules/core_exit.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# LinuxGSM core_exit.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Handles exiting of LinuxGSM by running and reporting an exit code. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +fn_exit_dev_debug() { + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "" + echo -e "${moduleselfname} exiting with code: ${exitcode}" + if [ -f "${rootdir}/dev-debug.log" ]; then + grep "modulefile=" "${rootdir}/dev-debug.log" | sed 's/modulefile=//g' > "${rootdir}/dev-debug-module-order.log" + fi + fi +} + +# If running dependency check as root will remove any files that belong to root user. +if [ "$(whoami)" == "root" ] && [ ! -f /.dockerenv ]; then + find "${lgsmdir}"/ -group root -prune -exec rm -rf {} + > /dev/null 2>&1 + find "${logdir}"/ -group root -prune -exec rm -rf {} + > /dev/null 2>&1 +fi + +if [ "${exitbypass}" ]; then + unset exitbypass +elif [ "${exitcode}" != "0" ]; then + # List LinuxGSM version in logs + fn_script_log_info "LinuxGSM version: ${version}" + if [ "${exitcode}" == "1" ]; then + fn_script_log_fatal "${moduleselfname} exiting with code: ${exitcode}" + elif [ "${exitcode}" == "2" ]; then + fn_script_log_error "${moduleselfname} exiting with code: ${exitcode}" + elif [ "${exitcode}" == "3" ]; then + fn_script_log_warn "${moduleselfname} exiting with code: ${exitcode}" + else + fn_script_log_warn "${moduleselfname} exiting with code: ${exitcode}" + fi + fn_exit_dev_debug + # remove trap. + trap - INT + exit "${exitcode}" +elif [ "${exitcode}" ] && [ "${exitcode}" == "0" ]; then + # List LinuxGSM version in logs + fn_script_log_info "LinuxGSM version: ${version}" + fn_script_log_pass "${moduleselfname} exiting with code: ${exitcode}" + fn_exit_dev_debug + # remove trap. + trap - INT + exit "${exitcode}" +else + # List LinuxGSM version in logs + fn_script_log_info "LinuxGSM version: ${version}" + fn_print_error "No exit code set" + fn_script_log_pass "${moduleselfname} exiting with code: NOT SET" + fn_exit_dev_debug + # remove trap. + trap - INT + exit "${exitcode}" +fi diff --git a/lgsm/modules/core_functions.sh b/lgsm/modules/core_functions.sh new file mode 100755 index 000000000..07a2ebd09 --- /dev/null +++ b/lgsm/modules/core_functions.sh @@ -0,0 +1,816 @@ +#!/bin/bash +# LinuxGSM core_functions.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# 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. + +module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +modulesversion="v23.2.0" + +# Core + +core_dl.sh() { + functionfile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + fi +} + +core_messages.sh() { + functionfile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + fi +} + +core_legacy.sh() { + functionfile="${FUNCNAME[0]}" + if [ "$(type fn_fetch_core_dl 2> /dev/null)" ]; then + fn_fetch_core_dl "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + else + fn_bootstrap_fetch_file_github "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + fi +} + +core_exit.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +core_getopt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +core_trap.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +core_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +core_github.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Commands + +command_backup.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_console.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_debug.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_details.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_sponsor.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_postdetails.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_test_alert.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_monitor.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_start.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_stop.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_validate.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_install.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_install_resources_mta.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_squad_license.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_mods_install.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_mods_update.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_mods_remove.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_fastdl.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_ts3_server_pass.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_restart.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_skeleton.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_wipe.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_send.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Checks + +check.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_config.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_deps.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_executable.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_glibc.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_ip.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_last_update.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_logs.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_permissions.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_root.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_status.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_system_dir.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_system_requirements.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_tmuxception.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +check_version.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Compress + +compress_unreal2_maps.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +compress_ut99_maps.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Mods + +mods_list.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +mods_core.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Dev + +command_dev_clear_functions.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_dev_debug.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_dev_detect_deps.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_dev_detect_glibc.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_dev_detect_ldd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_dev_query_raw.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Fix + +fix.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_ark.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_av.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_arma3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_armar.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_bt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_bo.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_cmw.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_csgo.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_dst.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_hw.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_ins.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_kf.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_kf2.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_lo.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_mcb.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_mta.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_nmrih.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_onset.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_ro.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_rust.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_rw.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_sfc.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_st.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_terraria.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_tf2.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_ut3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_rust.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_samp.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_sdtd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_sof2.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_squad.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_ts3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_ut2k4.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_ut.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_unt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_vh.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_wurm.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fix_zmr.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Info + +info_distro.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +info_game.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +info_messages.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +info_stats.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Alert + +alert.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_discord.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_email.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_ifttt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_mailgun.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_pushbullet.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_pushover.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_gotify.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_telegram.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_rocketchat.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +alert_slack.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} +# Logs + +core_logs.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Query + +query_gamedig.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Update + +command_update_functions.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_update_linuxgsm.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_update.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +command_check_update.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_ts3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_minecraft.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_minecraft_bedrock.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_papermc.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_mta.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_factorio.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_jediknight2.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_vintagestory.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +update_ut99.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +fn_update_functions.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# +## Installer functions +# + +fn_autoinstall() { + autoinstall=1 + command_install.sh +} + +install_complete.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_config.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_factorio_save.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_dst_token.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_eula.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_gsquery.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_gslt.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_header.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_logs.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_retry.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_server_dir.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} +install_server_files.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_stats.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_steamcmd.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_ts3.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_ts3db.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_ut2k4.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_dl_ut2k4.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +install_ut2k4_key.sh() { + functionfile="${FUNCNAME[0]}" + fn_fetch_function +} + +# Calls code required for legacy servers +core_legacy.sh + +# Creates tmp dir if missing +if [ ! -d "${tmpdir}" ]; then + mkdir -p "${tmpdir}" +fi + +# Creates lock dir if missing +if [ ! -d "${lockdir}" ]; then + mkdir -p "${lockdir}" +fi + +# Calls on-screen messages (bootstrap) +core_messages.sh + +#Calls file downloader (bootstrap) +core_dl.sh + +# Calls the global Ctrl-C trap +core_trap.sh diff --git a/lgsm/modules/core_getopt.sh b/lgsm/modules/core_getopt.sh new file mode 100644 index 000000000..222ad0cf8 --- /dev/null +++ b/lgsm/modules/core_getopt.sh @@ -0,0 +1,215 @@ +#!/bin/bash +# LinuxGSM core_getopt.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: getopt arguments. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +### Define all commands here. +## User commands | Trigger commands | Description +# Standard commands. +cmd_install=("i;install" "command_install.sh" "Install the server.") +cmd_auto_install=("ai;auto-install" "fn_autoinstall" "Install the server without prompts.") +cmd_start=("st;start" "command_start.sh" "Start the server.") +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_sponso=("s;sponsor" "command_sponsor.sh" "Donation options.") +cmd_send=("sd;send" "command_send.sh" "Send command to game server console.") +# Console servers only. +cmd_console=("c;console" "command_console.sh" "Access server console.") +cmd_debug=("d;debug" "command_debug.sh" "Start server directly in your terminal.") +# Update servers only. +cmd_update=("u;update" "command_update.sh" "Check and apply any server updates.") +cmd_check_update=("cu;check-update" "command_check_update.sh" "Check if a gameserver update is available") +cmd_force_update=("fu;force-update;update-restart;ur" "forceupdate=1; command_update.sh" "Apply server updates bypassing check.") +# SteamCMD servers only. +cmd_validate=("v;validate" "command_validate.sh" "Validate server files with SteamCMD.") +# Server with mods-install. +cmd_mods_install=("mi;mods-install" "command_mods_install.sh" "View and install available mods/addons.") +cmd_mods_remove=("mr;mods-remove" "command_mods_remove.sh" "View and remove an installed mod/addon.") +cmd_mods_update=("mu;mods-update" "command_mods_update.sh" "Update installed mods/addons.") +# Server specific. +cmd_change_password=("pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password.") +cmd_install_default_resources=("ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources.") +cmd_fullwipe=("fw;full-wipe;wa;wipeall" "serverwipe=1; command_wipe.sh" "Reset the map and remove blueprint data.") +cmd_mapwipe=("mw;map-wipe;w;wipe;wi" "mapwipe=1; command_wipe.sh" "Reset the map and keep blueprint data.") +cmd_map_compressor_u99=("mc;map-compressor" "compress_ut99_maps.sh" "Compresses all ${gamename} server maps.") +cmd_map_compressor_u2=("mc;map-compressor" "compress_unreal2_maps.sh" "Compresses all ${gamename} server maps.") +cmd_install_cdkey=("cd;server-cd-key" "install_ut2k4_key.sh" "Add your server cd key.") +cmd_install_dst_token=("ct;cluster-token" "install_dst_token.sh" "Configure cluster token.") +cmd_install_squad_license=("li;license" "install_squad_license.sh" "Add your Squad server license.") +cmd_fastdl=("fd;fastdl" "command_fastdl.sh" "Build a FastDL directory.") +# Dev commands. +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.") + +### Set specific opt here. + +currentopt=("${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monitor[@]}" "${cmd_test_alert[@]}" "${cmd_details[@]}" "${cmd_postdetails[@]}" "${cmd_skeleton[@]}") + +# Update LinuxGSM. +currentopt+=("${cmd_update_linuxgsm[@]}") + +# Exclude noupdate games here. +if [ "${shortname}" == "jk2" ] || [ "${engine}" != "idtech3" ]; then + if [ "${shortname}" != "bf1942" ] && [ "${shortname}" != "bfv" ] && [ "${engine}" != "idtech2" ] && [ "${engine}" != "iw2.0" ] && [ "${engine}" != "iw3.0" ] && [ "${engine}" != "quake" ] && [ "${shortname}" != "samp" ] && [ "${shortname}" != "ut2k4" ]; then + currentopt+=("${cmd_update[@]}" "${cmd_check_update[@]}") + # force update for SteamCMD or Multi Theft Auto only. + if [ "${appid}" ] || [ "${shortname}" == "mta" ]; then + currentopt+=("${cmd_force_update[@]}") + fi + fi +fi + +# Validate and check-update command. +if [ "${appid}" ]; then + currentopt+=("${cmd_validate[@]}") +fi + +# Backup. +currentopt+=("${cmd_backup[@]}") + +# Console & Debug. +currentopt+=("${cmd_console[@]}" "${cmd_debug[@]}") + +# Console send. +if [ "${consoleinteract}" == "yes" ]; then + currentopt+=("${cmd_send[@]}") +fi + +## Game server exclusive commands. + +# FastDL command. +if [ "${engine}" == "source" ]; then + currentopt+=("${cmd_fastdl[@]}") +fi + +# TeamSpeak exclusive. +if [ "${shortname}" == "ts3" ]; then + currentopt+=("${cmd_change_password[@]}") +fi + +# Rust exclusive. +if [ "${shortname}" == "rust" ]; then + currentopt+=("${cmd_fullwipe[@]}" "${cmd_mapwipe[@]}") +fi + +# Unreal exclusive. +if [ "${engine}" == "unreal2" ]; then + if [ "${shortname}" == "ut2k4" ]; then + currentopt+=("${cmd_install_cdkey[@]}" "${cmd_map_compressor_u2[@]}") + else + currentopt+=("${cmd_map_compressor_u2[@]}") + fi +fi +if [ "${engine}" == "unreal" ]; then + currentopt+=("${cmd_map_compressor_u99[@]}") +fi + +# DST exclusive. +if [ "${shortname}" == "dst" ]; then + currentopt+=("${cmd_install_dst_token[@]}") +fi + +# MTA exclusive. +if [ "${shortname}" == "mta" ]; then + currentopt+=("${cmd_install_default_resources[@]}") +fi + +# Squad license exclusive. +if [ "${shortname}" == "squad" ]; then + currentopt+=("${cmd_install_squad_license[@]}") +fi + +## Mods commands. +if [ "${engine}" == "source" ] || [ "${shortname}" == "rust" ] || [ "${shortname}" == "hq" ] || [ "${shortname}" == "sdtd" ] || [ "${shortname}" == "cs" ] || [ "${shortname}" == "dod" ] || [ "${shortname}" == "tfc" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "hldm" ] || [ "${shortname}" == "vh" ]; then + currentopt+=("${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}") +fi + +## Installer. +currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}") + +## Developer commands. +currentopt+=("${cmd_dev_debug[@]}") +if [ -f ".dev-debug" ]; then + currentopt+=("${cmd_dev_detect_deps[@]}" "${cmd_dev_detect_glibc[@]}" "${cmd_dev_detect_ldd[@]}" "${cmd_dev_query_raw[@]}" "${cmd_dev_clear_modules[@]}") +fi + +## Sponsor. +currentopt+=("${cmd_sponsor[@]}") + +### Build list of available commands. +optcommands=() +index="0" +for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do + cmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }') + for ((cmdindex = 1; cmdindex <= cmdamount; cmdindex++)); do + optcommands+=("$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')") + done +done + +# Shows LinuxGSM usage. +fn_opt_usage() { + echo -e "Usage: $0 [option]" + echo -e "" + echo -e "LinuxGSM - ${gamename} - Version ${version}" + echo -e "https://linuxgsm.com/${gameservername}" + echo -e "" + echo -e "${lightyellow}Commands${default}" + # Display available commands. + index="0" + { + for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do + # Hide developer commands. + if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then + echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}" + fi + done + } | column -s $'\t' -t + fn_script_log_pass "Display commands" + core_exit.sh +} + +# Check if command existw and run corresponding scripts, or display script usage. +if [ -z "${getopt}" ]; then + fn_opt_usage +fi +# If command exists. +for i in "${optcommands[@]}"; do + if [ "${i}" == "${getopt}" ]; then + # Seek and run command. + index="0" + for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do + currcmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }') + for ((currcmdindex = 1; currcmdindex <= currcmdamount; currcmdindex++)); do + if [ "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then + # Run command. + eval "${currentopt[index + 1]}" + # Exit should occur in modules. Should this not happen print an error + fn_print_error2_nl "Command did not exit correctly: ${getopt}" + fn_script_log_error "Command did not exit correctly: ${getopt}" + core_exit.sh + fi + done + done + fi +done + +# If we're executing this, it means command was not found. +fn_print_error2_nl "Unknown command: $0 ${getopt}" +fn_script_log_error "Unknown command: $0 ${getopt}" +fn_opt_usage +core_exit.sh diff --git a/lgsm/modules/core_github.sh b/lgsm/modules/core_github.sh new file mode 100644 index 000000000..228fe1078 --- /dev/null +++ b/lgsm/modules/core_github.sh @@ -0,0 +1,114 @@ +#!/bin/bash +# LinuxGSM core_github.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: core module file for updates via github + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +github_api="https://api.github.com" + +fn_githublocalversionfile() { + local githubreleaseuser="${1}" + local githubreleaserepo="${2}" + + githublocalversionfile="${datadir}/github-${githubreleaseuser}-${githubreleaserepo}-version" +} + +# $1 githubuser/group +# $2 github repo name +fn_github_get_latest_release_version() { + local githubreleaseuser="${1}" + local githubreleaserepo="${2}" + local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest" + + githubreleaseversion=$(curl -s --connect-timeout 10 "${githublatestreleaseurl}" | jq '.tag_name') + + # error if no version is there + if [ -z "${githubreleaseversion}" ]; then + fn_print_fail_nl "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}" + fn_script_log_fatal "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}" + fi +} + +# $1 githubuser/group +# $2 github repo name +fn_github_set_latest_release_version() { + local githubreleaseuser="${1}" + local githubreleaserepo="${2}" + + fn_githublocalversionfile "${githubreleaseuser}" "${githubreleaserepo}" + + local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest" + githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq -r '.tag_name') + + # error if no version is there + if [ -z "${githubreleaseversion}" ]; then + fn_print_fail_nl "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}" + fn_script_log_fatal "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}" + else + echo "${githubreleaseversion}" > "${githublocalversionfile}" + fi +} + +# $1 githubuser/group +# $2 github repo name +fn_github_get_installed_version() { + local githubreleaseuser="${1}" + local githubreleaserepo="${2}" + + fn_githublocalversionfile "${githubreleaseuser}" "${githubreleaserepo}" + + githublocalversion=$(cat "${githublocalversionfile}") +} + +# $1 githubuser/group +# $2 github repo name +# if a update needs to be downloaded - updateneeded is set to 1 +fn_github_compare_version() { + local githubreleaseuser="${1}" + local githubreleaserepo="${2}" + exitcode=0 + updateneeded=0 + + fn_githublocalversionfile "${githubreleaseuser}" "${githubreleaserepo}" + local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest" + + githublocalversion=$(cat "${githublocalversionfile}") + githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq '.tag_name') + + # error if no version is there + if [ -z "${githubreleaseversion}" ]; then + fn_print_fail_nl "Can not get version from Github Api for ${githubreleaseuser}/${githubreleaserepo}" + fn_script_log_fatal "Can not get version from Github Api for ${githubreleaseuser}/${githubreleaserepo}" + else + if [ "${githublocalversion}" == "${githubreleaseversion}" ]; then + echo -en "\n" + echo -e "No update from github.com/${githubreleaseuser}/${githubreleaserepo}/ available:" + echo -e "* Local build: ${red}${githublocalversion}${default}" + echo -e "* Remote build: ${green}${githubreleaseversion}${default}" + echo -en "\n" + else + # check if version that is installed is higher than the remote version to not override it + last_version=$(echo -e "${githublocalversion}\n${githubreleaseversion}" | sort -V | head -n1) + if [ "${githubreleaseversion}" == "${last_version}" ]; then + echo -en "\n" + echo -e "Update from github.com/${githubreleaseuser}/${githubreleaserepo}/ available:" + echo -e "* Local build: ${red}${githublocalversion}${default}" + echo -e "* Remote build: ${green}${githubreleaseversion}${default}" + echo -en "\n" + updateneeded=1 + else + # local version is higher than the remote version output this to the user + # strange case but could be possible, as a release could be removed from github + echo -en "\n" + echo -e "Local version is newer than the remote version" + echo -e "* Local version: ${green}${githublocalversion}${default}" + echo -e "* Remote version: ${green}${githubreleaseversion}${default}" + echo -en "\n" + exitcode=1 + fi + fi + fi +} diff --git a/lgsm/modules/core_legacy.sh b/lgsm/modules/core_legacy.sh new file mode 100644 index 000000000..2ed942abd --- /dev/null +++ b/lgsm/modules/core_legacy.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# LinuxGSM core_legacy.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Code for backwards compatability with older versions of LinuxGSM. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +# This is to help the transition to v20.3.0 and above +legacy_versions_array=(v20.2.1 v20.2.0 v20.1.5 v20.1.4 v20.1.3 v20.1.2 v20.1.1 v20.1.0 v19.12.5 v19.12.4 v19.12.3 v19.12.2 v19.12.1 v19.12.0) +for legacy_version in "${legacy_versions_array[@]}"; do + if [ "${version}" == "${legacy_version}" ]; then + legacymode=1 + fi +done + +if [ -z "${serverfiles}" ]; then + serverfiles="${filesdir}" +fi + +if [ -z "${logdir}" ]; then + logdir="${rootdir}/log" +fi + +if [ -z "${lgsmlogdir}" ]; then + lgsmlogdir="${scriptlogdir}" +fi + +if [ -z "${lgsmlog}" ]; then + lgsmlog="${scriptlog}" +fi + +if [ -z "${lgsmlogdate}" ]; then + lgsmlogdate="${scriptlogdate}" +fi + +if [ -z "${steamcmddir}" ]; then + steamcmddir="${HOME}/.steam/steamcmd" +fi + +if [ -z "${lgsmdir}" ]; then + lgsmdir="${rootdir}/lgsm" +fi + +if [ -z "${tmpdir}" ]; then + tmpdir="${lgsmdir}/tmp" +fi + +if [ -z "${alertlog}" ]; then + alertlog="${emaillog}" +fi + +if [ -z "${servicename}" ]; then + servicename="${selfname}" +fi + +# Alternations to workshop variables. +if [ -z "${wsapikey}" ]; then + if [ "${workshopauth}" ]; then + wsapikey="${workshopauth}" + elif [ "${authkey}" ]; then + wsapikey="${authkey}" + fi +fi + +if [ -z "${wscollectionid}" ]; then + if [ "${workshopauth}" ]; then + wscollectionid="${ws_collection_id}" + elif [ "${authkey}" ]; then + wscollectionid="${workshopcollectionid}" + fi +fi + +if [ -z "${wsstartmap}" ]; then + if [ "${ws_start_map}" ]; then + wscollectionid="${ws_start_map}" + fi +fi + +# 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" +if [ -d "${lgsmdir}/functions" ]; then + if [ "$(find "${lgsmdir}/modules"/ -type f -mtime +"14" | wc -l)" -ne "0" ]; then + rm -rf "${lgsmdir:?}/functions" + fi +fi + +fn_parms() { + fn_reload_startparameters + parms="${startparameters}" +} diff --git a/lgsm/modules/core_logs.sh b/lgsm/modules/core_logs.sh new file mode 100644 index 000000000..8057f30f7 --- /dev/null +++ b/lgsm/modules/core_logs.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# LinuxGSM core_logs.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Acts as a log rotator, removing old logs. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +# Check if logfile variable and file exist, create logfile if it doesn't exist. +if [ "${consolelog}" ]; then + if [ ! -f "${consolelog}" ]; then + touch "${consolelog}" + fi +fi + +# For games not displaying a console, and having logs into their game directory. +check_status.sh +if [ "${status}" != "0" ] && [ "${commandname}" == "START" ] && [ -n "${gamelogfile}" ]; then + if [ "$(find "${systemdir}" -name "gamelog*.log")" ]; then + fn_print_info "Moving game logs to ${gamelogdir}" + fn_script_log_info "Moving game logs to ${gamelogdir}" + echo -en "\n" + fn_sleep_time + mv "${systemdir}"/gamelog*.log "${gamelogdir}" + fi +fi + +# Log manager will start the cleanup if it finds logs older than "${logdays}". +if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ]; then + fn_print_dots "Starting" + # Set common logs directories + commonlogs="${systemdir}/logs" + commonsourcelogs="${systemdir}/*/logs" + # Set addon logs directories + sourcemodlogdir="${systemdir}/addons/sourcemod/logs" + ulxlogdir="${systemdir}/data/ulx_logs" + darkrplogdir="${systemdir}/data/darkrp_logs" + legacyserverlogdir="${logdir}/server" + # Setting up counting variables + scriptcount="0" + consolecount="0" + gamecount="0" + srcdscount="0" + smcount="0" + ulxcount="0" + darkrpcount="0" + legacycount="0" + fn_sleep_time + fn_print_info "Removing logs older than ${logdays} days" + fn_script_log_info "Removing logs older than ${logdays} days" + # Logging logfiles to be removed according to "${logdays}", counting and removing them. + # Script logfiles. + find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" + scriptcount=$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l) + find "${lgsmlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; + # SRCDS and unreal logfiles. + if [ "${engine}" == "unreal2" ] || [ "${engine}" == "source" ]; then + find "${gamelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" + gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}" | wc -l) + find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; + fi + # Console logfiles. + if [ "${consolelog}" ]; then + find "${consolelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" + consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}" | wc -l) + find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; + fi + # Common logfiles. + if [ -d "${commonlogs}" ]; then + find "${commonlogs}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" + smcount=$(find "${commonlogs}"/ -type f -mtime +"${logdays}" | wc -l) + find "${commonlogs}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; + fi + if [ -d "${commonsourcelogs}" ]; then + find "${commonsourcelogs}"/* -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" + smcount=$(find "${commonsourcelogs}"/* -type f -mtime +"${logdays}" | wc -l) + find "${commonsourcelogs}"/* -mtime +"${logdays}" -type f -exec rm -f {} \; + fi + # Source addons logfiles. + if [ "${engine}" == "source" ]; then + # SourceMod logfiles. + if [ -d "${sourcemodlogdir}" ]; then + find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" + smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}" | wc -l) + find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; + fi + # Garry's Mod logfiles. + if [ "${shortname}" == "gmod" ]; then + # ULX logfiles. + if [ -d "${ulxlogdir}" ]; then + find "${ulxlogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" + ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}" | wc -l) + find "${ulxlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; + fi + # DarkRP logfiles. + if [ -d "${darkrplogdir}" ]; then + find "${darkrplogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}" + darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}" | wc -l) + find "${darkrplogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; + fi + fi + fi + + # Count total amount of files removed. + countlogs=$((scriptcount + consolecount + gamecount + srcdscount + smcount + ulxcount + darkrpcount)) + # Job done. + fn_print_ok "Removed ${countlogs} log files" + fn_script_log "Removed ${countlogs} log files" +fi diff --git a/lgsm/modules/core_messages.sh b/lgsm/modules/core_messages.sh new file mode 100644 index 000000000..6d3ca9a25 --- /dev/null +++ b/lgsm/modules/core_messages.sh @@ -0,0 +1,598 @@ +#!/bin/bash +# LinuxGSM core_messages.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Defines on-screen messages such as [ OK ] and how script logs look. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +# nl: new line: message is following by a new line. +# eol: end of line: message is placed at the end of the current line. +fn_ansi_loader() { + if [ "${ansi}" != "off" ]; then + # echo colors + default="\e[0m" + black="\e[30m" + red="\e[31m" + lightred="\e[91m" + green="\e[32m" + lightgreen="\e[92m" + yellow="\e[33m" + lightyellow="\e[93m" + blue="\e[34m" + lightblue="\e[94m" + magenta="\e[35m" + lightmagenta="\e[95m" + cyan="\e[36m" + lightcyan="\e[96m" + darkgrey="\e[90m" + lightgrey="\e[37m" + white="\e[97m" + fi + # carriage return & erase to end of line. + creeol="\r\033[K" +} + +fn_sleep_time() { + if [ "${sleeptime}" != "0" ] || [ "${travistest}" != "1" ]; then + if [ -z "${sleeptime}" ]; then + sleeptime=0.5 + fi + sleep "${sleeptime}" + fi +} + +# Log display +######################## +## Feb 28 14:56:58 ut99-server: Monitor: +fn_script_log() { + if [ -d "${lgsmlogdir}" ]; then + if [ -n "${commandname}" ]; then + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ${1}" >> "${lgsmlog}" + else + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${1}" >> "${lgsmlog}" + fi + fi +} + +## Feb 28 14:56:58 ut99-server: Monitor: PASS: +fn_script_log_pass() { + if [ -d "${lgsmlogdir}" ]; then + + if [ -n "${commandname}" ]; then + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: PASS: ${1}" >> "${lgsmlog}" + else + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: PASS: ${1}" >> "${lgsmlog}" + fi + fi + exitcode=0 +} + +## Feb 28 14:56:58 ut99-server: Monitor: FATAL: +fn_script_log_fatal() { + if [ -d "${lgsmlogdir}" ]; then + if [ -n "${commandname}" ]; then + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}" + else + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: FATAL: ${1}" >> "${lgsmlog}" + fi + fi + exitcode=1 +} + +## Feb 28 14:56:58 ut99-server: Monitor: ERROR: +fn_script_log_error() { + if [ -d "${lgsmlogdir}" ]; then + if [ -n "${commandname}" ]; then + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ERROR: ${1}" >> "${lgsmlog}" + else + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ERROR: ${1}" >> "${lgsmlog}" + fi + fi + exitcode=2 +} + +## Feb 28 14:56:58 ut99-server: Monitor: WARN: +fn_script_log_warn() { + if [ -d "${lgsmlogdir}" ]; then + if [ -n "${commandname}" ]; then + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: WARN: ${1}" >> "${lgsmlog}" + else + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: WARN: ${1}" >> "${lgsmlog}" + fi + fi + exitcode=3 +} + +## Feb 28 14:56:58 ut99-server: Monitor: INFO: +fn_script_log_info() { + if [ -d "${lgsmlogdir}" ]; then + if [ -n "${commandname}" ]; then + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: INFO: ${1}" >> "${lgsmlog}" + else + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: INFO: ${1}" >> "${lgsmlog}" + fi + fi +} + +## Feb 28 14:56:58 ut99-server: Monitor: UPDATE: +fn_script_log_update() { + if [ -d "${lgsmlogdir}" ]; then + if [ -n "${commandname}" ]; then + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: UPDATE: ${1}" >> "${lgsmlog}" + else + echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: UPDATE: ${1}" >> "${lgsmlog}" + fi + fi +} + +# On-Screen - Automated functions +################################## + +# [ .... ] +fn_print_dots() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[ .... ] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[ .... ] $*" + fi + fn_sleep_time +} + +fn_print_dots_nl() { + if [ "${commandaction}" ]; then + echo -e "${creeol}[ .... ] ${commandaction} ${selfname}: $*" + else + echo -e "${creeol}[ .... ] $*" + fi + fn_sleep_time + echo -en "\n" +} + +# [ OK ] +fn_print_ok() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${green} OK ${default}] $*" + fi + fn_sleep_time +} + +fn_print_ok_nl() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${green} OK ${default}] $*" + fi + fn_sleep_time + echo -en "\n" +} + +# [ FAIL ] +fn_print_fail() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${red} FAIL ${default}] $*" + fi + fn_sleep_time +} + +fn_print_fail_nl() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${red} FAIL ${default}] $*" + fi + fn_sleep_time + echo -en "\n" +} + +# [ ERROR ] +fn_print_error() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${red} ERROR ${default}] $*" + fi + fn_sleep_time +} + +fn_print_error_nl() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${red} ERROR ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${red} ERROR ${default}] $*" + fi + fn_sleep_time + echo -en "\n" +} + +# [ WARN ] +fn_print_warn() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${lightyellow} WARN ${default}] $*" + fi + fn_sleep_time +} + +fn_print_warn_nl() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${lightyellow} WARN ${default}] $*" + fi + fn_sleep_time + echo -en "\n" +} + +# [ INFO ] +fn_print_info() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${cyan} INFO ${default}] $*" + fi + fn_sleep_time +} + +fn_print_info_nl() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${cyan} INFO ${default}] $*" + fi + fn_sleep_time + echo -en "\n" +} + +# [ START ] +fn_print_start() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${lightgreen} START ${default}] $*" + fi + fn_sleep_time +} + +fn_print_start_nl() { + if [ "${commandaction}" ]; then + echo -en "${creeol}[${lightgreen} START ${default}] ${commandaction} ${selfname}: $*" + else + echo -en "${creeol}[${lightgreen} START ${default}] $*" + fi + fn_sleep_time + echo -en "\n" +} + +# On-Screen - Interactive messages +################################## + +# No More Room in Hell Debug +# ================================= +fn_print_header() { + echo -e "" + echo -e "${lightyellow}${gamename} ${commandaction}${default}" + echo -e "=================================${default}" +} + +# Complete! +fn_print_complete() { + echo -en "${green}Complete!${default} $*" + fn_sleep_time +} + +fn_print_complete_nl() { + echo -e "${green}Complete!${default} $*" + fn_sleep_time +} + +# Failure! +fn_print_failure() { + echo -en "${red}Failure!${default} $*" + fn_sleep_time +} + +fn_print_failure_nl() { + echo -e "${red}Failure!${default} $*" + fn_sleep_time +} + +# Error! +fn_print_error2() { + echo -en "${red}Error!${default} $*" + fn_sleep_time +} + +fn_print_error2_nl() { + echo -e "${red}Error!${default} $*" + fn_sleep_time +} + +# Warning! +fn_print_warning() { + echo -en "${lightyellow}Warning!${default} $*" + fn_sleep_time +} + +fn_print_warning_nl() { + echo -e "${lightyellow}Warning!${default} $*" + fn_sleep_time +} + +# Information! +fn_print_information() { + echo -en "${cyan}Information!${default} $*" + fn_sleep_time +} + +fn_print_information_nl() { + echo -e "${cyan}Information!${default} $*" + fn_sleep_time +} + +# Y/N Prompt +fn_prompt_yn() { + local prompt="$1" + local initial="$2" + + if [ "${initial}" == "Y" ]; then + prompt+=" [Y/n] " + elif [ "${initial}" == "N" ]; then + prompt+=" [y/N] " + else + prompt+=" [y/n] " + fi + + while true; do + read -e -i "${initial}" -p "${prompt}" -r yn + case "${yn}" in + [Yy] | [Yy][Ee][Ss]) return 0 ;; + [Nn] | [Nn][Oo]) return 1 ;; + *) echo -e "Please answer yes or no." ;; + esac + done +} + +# Prompt for message +fn_prompt_message() { + while true; do + unset prompt + local prompt="$1" + read -e -p "${prompt}" -r answer + if fn_prompt_yn "Continue" Y; then + break + fi + done + echo "${answer}" +} + +# On-Screen End of Line +################################## + +# YES +fn_print_yes_eol() { + echo -en "${cyan}YES${default}" + fn_sleep_time +} + +fn_print_yes_eol_nl() { + echo -e "${cyan}YES${default}" + fn_sleep_time +} + +# NO +fn_print_no_eol() { + echo -en "${red}NO${default}" + fn_sleep_time +} + +fn_print_no_eol_nl() { + echo -e "${red}NO${default}" + fn_sleep_time +} + +# OK +fn_print_ok_eol() { + echo -en "${green}OK${default}" + fn_sleep_time +} + +fn_print_ok_eol_nl() { + echo -e "${green}OK${default}" + fn_sleep_time +} + +# FAIL +fn_print_fail_eol() { + echo -en "${red}FAIL${default}" + fn_sleep_time +} + +fn_print_fail_eol_nl() { + echo -e "${red}FAIL${default}" + fn_sleep_time +} + +# ERROR +fn_print_error_eol() { + echo -en "${red}ERROR${default}" + fn_sleep_time +} + +fn_print_error_eol_nl() { + echo -e "${red}ERROR${default}" + fn_sleep_time +} + +# WAIT +fn_print_wait_eol() { + echo -en "${cyan}WAIT${default}" + fn_sleep_time +} + +fn_print_wait_eol_nl() { + echo -e "${cyan}WAIT${default}" + fn_sleep_time +} + +# WARN +fn_print_warn_eol() { + echo -en "${lightyellow}WARN${default}" + fn_sleep_time +} + +fn_print_warn_eol_nl() { + echo -e "${lightyellow}WARN${default}" + fn_sleep_time +} + +# INFO +fn_print_info_eol() { + echo -en "${cyan}INFO${default}" + fn_sleep_time +} + +fn_print_info_eol_nl() { + echo -e "${cyan}INFO${default}" + fn_sleep_time +} + +# QUERYING +fn_print_querying_eol() { + echo -en "${cyan}QUERYING${default}" + fn_sleep_time +} + +fn_print_querying_eol_nl() { + echo -e "${cyan}QUERYING${default}" + fn_sleep_time +} + +# CHECKING +fn_print_checking_eol() { + echo -en "${cyan}CHECKING${default}" + fn_sleep_time +} + +fn_print_checking_eol_nl() { + echo -e "${cyan}CHECKING${default}" + fn_sleep_time +} + +# DELAY +fn_print_delay_eol() { + echo -en "${green}DELAY${default}" + fn_sleep_time +} + +fn_print_delay_eol_nl() { + echo -e "${green}DELAY${default}" + fn_sleep_time +} + +# CANCELED +fn_print_canceled_eol() { + echo -en "${lightyellow}CANCELED${default}" + fn_sleep_time +} + +fn_print_canceled_eol_nl() { + echo -e "${lightyellow}CANCELED${default}" + fn_sleep_time +} + +# REMOVED +fn_print_removed_eol() { + echo -en "${red}REMOVED${default}" + fn_sleep_time +} + +fn_print_removed_eol_nl() { + echo -e "${red}REMOVED${default}" + fn_sleep_time +} + +# UPDATE +fn_print_update_eol() { + echo -en "${cyan}UPDATE${default}" + fn_sleep_time +} + +fn_print_update_eol_nl() { + echo -e "${cyan}UPDATE${default}" + fn_sleep_time +} + +fn_print_ascii_logo() { + echo -e "" + echo -e " mdMMMMbm" + echo -e " mMMMMMMMMMMm" + echo -e " mMMMMMMMMMMMMm" + echo -e " mMMMMMMMMMMMMMMm" + echo -e " hMMMV^VMMV^VMMMh" + echo -e " MMMMM MM MMMMM" + echo -e " hMMs vv sMMh" + echo -e " hMMM: :MMMh" + echo -e " .hMMMh hMMMh." + echo -e " -dMMMh ${lightgrey}__${default} hMMMd-" + echo -e " :mMMMs ${lightgrey}||${default} sMMMm:" + echo -e " :MMMM+ ${lightgrey}||${default} ${red}_${default} +NMMN:" + echo -e " .mMMM+ ${lightgrey}========${default} +MMMm." + echo -e " yMMMy ${darkgrey}##############${default} yMMMy" + echo -e " mMMM: ${darkgrey}##############${default} :MMMm" + echo -e " mMM ${lightyellow}nn${default} ${lightyellow}nn${default} ${lightyellow}nn${default} ${lightyellow}nn${default} MMm" + echo -e " o ${lightyellow}nNNNNNNNn${default} ${lightyellow}nNNNNNNNn${default} o" + echo -e " ${lightyellow}nNNNNNNNNNn${default} ${lightyellow}nNNNNNNNNNn${default}" + echo -e " ${lightyellow}nNNNNNNNNNNN${default} ${lightyellow}NNNNNNNNNNNn${default}" + echo -e " ${lightyellow}+NNNNNNNNN:${default} ${lightyellow}:NNNNNNNNN+${default}" + echo -e " ${lightyellow}nNNNNNNN${default} /\ ${lightyellow}NNNNNNNn${default}" + echo -e " ${lightyellow}nnnnn${default} db ${lightyellow}nnnnn${default}" + echo -e "" + echo -e "${lightyellow}888${default} ${lightyellow}d8b${default} ${default}.d8888b. .d8888b. 888b d888" + echo -e "${lightyellow}888 Y8P ${default}d88P Y88b d88P Y88b 8888b d8888" + echo -e "${lightyellow}888${default} ${default}888${default} 888 Y88b. 88888b.d88888" + echo -e "${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}88888b.${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} 888 Y888b. 888Y88888P888" + echo -e "${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}88b${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}Y8bd8P${default} 888 88888 Y88b. 888 Y888P 888" + echo -e "${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}X88K${default} 888 888 888 888 Y8P 888" + echo -e "${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}Y88b${default} ${lightyellow}88Y${default} ${lightyellow}.d8pq8b.${default} Y88b d88P Y88b d88P 888 * 888" + echo -e "${lightyellow}LinuxGSM${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}888${default} ${lightyellow}Y8888Y${default} ${lightyellow}888${default} ${lightyellow}888${default} Y2012P88 Y8888P 888 888" + echo -e "" +} + +fn_print_restart_warning() { + fn_print_warn "${selfname} will be restarted" + fn_script_log_warn "${selfname} will be restarted" + totalseconds=3 + for seconds in {3..1}; do + fn_print_warn "${selfname} will be restarted: ${totalseconds}" + totalseconds=$((totalseconds - 1)) + sleep 1 + if [ "${seconds}" == "0" ]; then + break + fi + done + fn_print_warn_nl "${selfname} will be restarted" +} + +# Functions below are used to ensure that logs and UI correctly reflect the command it is actually running. +# Useful when a command has to call upon another command causing the other command to overrite commandname variables + +# Used to remember the command that ran first. +fn_firstcommand_set() { + if [ -z "${firstcommandname}" ]; then + firstcommandname="${commandname}" + firstcommandaction="${commandaction}" + fi +} + +# Used to reset commandname variables to the command the script ran first. +fn_firstcommand_reset() { + commandname="${firstcommandname}" + commandaction="${firstcommandaction}" +} diff --git a/lgsm/modules/core_modules.sh b/lgsm/modules/core_modules.sh new file mode 100644 index 000000000..8eb843b5a --- /dev/null +++ b/lgsm/modules/core_modules.sh @@ -0,0 +1,816 @@ +#!/bin/bash +# LinuxGSM core_modules.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Defines all modules to allow download and execution of modules using fn_fetch_module. +# This module is called first before any other module. Without this file other modules will not load. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +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_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_exit.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_steamcmd.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_console.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_sponsor.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_monitor.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_validate.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 +} + +install_squad_license.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_remove.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_restart.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_send.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Checks + +check.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_executable.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_last_update.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_root.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_system_dir.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_version.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Compress + +compress_unreal2_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_core.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Dev + +command_dev_clear_modules.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_glibc.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 +} + +# Fix + +fix.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_arma3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_armar.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_bt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_bo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_cmw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_csgo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_dst.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_hw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ins.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_kf.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_kf2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_lo.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_mcb.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_mta.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_nmrih.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_onset.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ro.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_rust.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_rw.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_sfc.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_st.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_steamcmd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_terraria.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_tf2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ut3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_rust.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_samp.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_sdtd.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_sof2.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_squad.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ts3.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ut2k4.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_ut.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_unt.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_vh.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_wurm.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +fix_zmr.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Info + +info_distro.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_stats.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Alert + +alert.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_ifttt.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_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_rocketchat.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 +} + +# Query + +query_gamedig.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Update + +command_update_modules.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_check_update.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_bedrock.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +update_papermc.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_jediknight2.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_ut99.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 +} + +install_complete.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_dst_token.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_gslt.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_retry.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_stats.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_ts3db.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_ut2k4_key.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + +# Calls code required for legacy servers +core_legacy.sh + +# Creates tmp dir if missing +if [ ! -d "${tmpdir}" ]; then + mkdir -p "${tmpdir}" +fi + +# Creates lock dir if missing +if [ ! -d "${lockdir}" ]; then + mkdir -p "${lockdir}" +fi + +# Calls on-screen messages (bootstrap) +core_messages.sh + +#Calls file downloader (bootstrap) +core_dl.sh + +# Calls the global Ctrl-C trap +core_trap.sh diff --git a/lgsm/modules/core_steamcmd.sh b/lgsm/modules/core_steamcmd.sh new file mode 100644 index 000000000..78c30f60a --- /dev/null +++ b/lgsm/modules/core_steamcmd.sh @@ -0,0 +1,330 @@ +#!/bin/bash +# LinuxGSM core_steamcmd.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Core modules for SteamCMD + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +fn_install_steamcmd() { + if [ "${shortname}" == "ark" ] && [ "${installsteamcmd}" == "1" ]; then + steamcmddir="${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" + fi + if [ ! -d "${steamcmddir}" ]; then + mkdir -p "${steamcmddir}" + fi + fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "" "" "" "${tmpdir}" "steamcmd_linux.tar.gz" "nochmodx" "norun" "noforce" "nohash" + fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" + chmod +x "${steamcmddir}/steamcmd.sh" +} + +fn_check_steamcmd_user() { + # Checks if steamuser is setup. + if [ "${steamuser}" == "username" ]; then + fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}" + echo -e " * Change steamuser=\"username\" to a valid steam login." + if [ -d "${lgsmlogdir}" ]; then + fn_script_log_fatal "Steam login not set. Update steamuser in ${configdirserver}" + fi + core_exit.sh + fi + # Anonymous user is set if steamuser is missing. + if [ -z "${steamuser}" ]; then + if [ -d "${lgsmlogdir}" ]; then + fn_script_log_info "Using anonymous Steam login" + fi + steamuser="anonymous" + steampass='' + fi +} + +fn_check_steamcmd() { + # Checks if SteamCMD exists when starting or updating a server. + # Only install if steamcmd package is missing or steamcmd dir is missing. + if [ ! -f "${steamcmddir}/steamcmd.sh" ] && [ -z "$(command -v steamcmd 2> /dev/null)" ]; then + if [ "${commandname}" == "INSTALL" ]; then + fn_install_steamcmd + else + fn_print_warn_nl "SteamCMD is missing" + fn_script_log_warn "SteamCMD is missing" + fn_install_steamcmd + fi + elif [ "${commandname}" == "INSTALL" ]; then + fn_print_information "SteamCMD is already installed..." + fn_print_ok_eol_nl + fi +} + +fn_check_steamcmd_dir() { + # Worksround that pre-installs the correct steam directories to ensure all packages use the correct Standard. + # https://github.com/ValveSoftware/steam-for-linux/issues/6976#issuecomment-610446347 + + # Create Steam installation directory. + if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then + mkdir -p "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" + fi + + # Create common Steam directory. + if [ ! -d "${HOME}/.steam" ]; then + mkdir -p "${HOME}/.steam" + fi + + # Symbolic links to Steam installation directory. + if [ ! -L "${HOME}/.steam/root" ]; then + if [ -d "${HOME}/.steam/root" ]; then + rm -f "${HOME:?}/.steam/root" + fi + ln -s "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" "${HOME}/.steam/root" + fi + + if [ ! -L "${HOME}/.steam/steam" ]; then + if [ -d "${HOME}/.steam/steam" ]; then + rm -rf "${HOME}/.steam/steam" + fi + ln -s "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" "${HOME}/.steam/steam" + fi +} + +fn_check_steamcmd_dir_legacy() { + # Remove old Steam installation directories ~/Steam and ${rootdir}/steamcmd + if [ -d "${rootdir}/steamcmd" ] && [ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then + rm -rf "${rootdir:?}/steamcmd" + fi + + if [ -d "${HOME}/Steam" ] && [ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then + rm -rf "${HOME}/Steam" + fi +} + +fn_check_steamcmd_steamapp() { + # Check that steamapp directory fixes issue #3481 + if [ ! -d "${serverfiles}/steamapps" ]; then + mkdir -p "${serverfiles}/steamapps" + fi +} + +fn_check_steamcmd_ark() { + # Checks if SteamCMD exists in + # Engine/Binaries/ThirdParty/SteamCMD/Linux + # to allow ark mods to work + if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then + installsteamcmd=1 + if [ "${commandname}" == "INSTALL" ]; then + fn_install_steamcmd + else + fn_print_warn_nl "ARK mods SteamCMD is missing" + fn_script_log_warn "ARK mods SteamCMD is missing" + fn_install_steamcmd + fi + elif [ "${commandname}" == "INSTALL" ]; then + fn_print_information "ARK mods SteamCMD is already installed..." + fn_print_ok_eol_nl + fi +} + +fn_check_steamcmd_clear() { + # Will remove steamcmd dir if steamcmd package is installed. + if [ "$(command -v steamcmd 2> /dev/null)" ] && [ -d "${rootdir}/steamcmd" ]; then + rm -rf "${steamcmddir:?}" + exitcode=$? + if [ "${exitcode}" != 0 ]; then + fn_script_log_fatal "Removing ${rootdir}/steamcmd" + else + fn_script_log_pass "Removing ${rootdir}/steamcmd" + fi + fi +} + +fn_check_steamcmd_exec() { + if [ "$(command -v steamcmd 2> /dev/null)" ]; then + steamcmdcommand="steamcmd" + else + steamcmdcommand="./steamcmd.sh" + fi +} + +fn_update_steamcmd_localbuild() { + # Gets local build info. + fn_print_dots "Checking local build: ${remotelocation}" + fn_appmanifest_check + # Uses appmanifest to find local build. + localbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) + + # Set branch to public if no custom branch. + if [ -z "${branch}" ]; then + branch="public" + fi + + # Checks if localbuild variable has been set. + if [ -z "${localbuild}" ]; then + fn_print_fail "Checking local build: ${remotelocation}: missing local build info" + fn_script_log_fatal "Missing local build info" + core_exit.sh + else + fn_print_ok "Checking local build: ${remotelocation}" + fn_script_log_pass "Checking local build" + fi +} + +fn_update_steamcmd_remotebuild() { + # Get remote build info. + if [ -d "${steamcmddir}" ]; then + cd "${steamcmddir}" || exit + fi + + # Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD. + if [ "$(find "${HOME}" -type f -name "appinfo.vdf" | wc -l)" -ne "0" ]; then + find "${HOME}" -type f -name "appinfo.vdf" -exec rm -f {} \; + fi + + # password for branch not needed to check the buildid + remotebuildversion=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed -e '/"branches"/,/^}/!d' | sed -n "/\"${branch}\"/,/}/p" | grep -m 1 buildid | tr -cd '[:digit:]') + + if [ "${firstcommandname}" != "INSTALL" ]; then + fn_print_dots "Checking remote build: ${remotelocation}" + # Checks if remotebuildversion variable has been set. + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "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 "${remotebuildversion}" ] || [ "${remotebuildversion}" == "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_steamcmd_compare() { + fn_print_dots "Checking for update: ${remotelocation}" + if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then + fn_print_ok_nl "Checking for update: ${remotelocation}" + echo -en "\n" + echo -e "Update available" + echo -e "* Local build: ${red}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuildversion}${default}" + if [ -n "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + if [ -n "${betapassword}" ]; then + echo -e "* Branch password: ${betapassword}" + fi + echo -e "https://steamdb.info/app/${appid}/" + echo -en "\n" + fn_script_log_info "Update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + if [ -n "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi + if [ -n "${betapassword}" ]; then + fn_script_log_info "Branch password: ${betapassword}" + fi + fn_script_log_info "${localbuild} > ${remotebuildversion}" + + if [ "${commandname}" == "UPDATE" ]; then + unset updateonstart + check_status.sh + # If server stopped. + if [ "${status}" == "0" ]; then + fn_dl_steamcmd + # If server started. + else + fn_print_restart_warning + exitbypass=1 + command_stop.sh + fn_firstcommand_reset + exitbypass=1 + fn_dl_steamcmd + exitbypass=1 + command_start.sh + fn_firstcommand_reset + fi + unset exitbypass + date +%s > "${lockdir}/lastupdate.lock" + alert="update" + elif [ "${commandname}" == "CHECK-UPDATE" ]; then + alert="check-update" + fi + 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}${default}" + echo -e "* Remote build: ${green}${remotebuildversion}${default}" + if [ -n "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + if [ -n "${betapassword}" ]; then + echo -e "* Branch password: ${betapassword}" + fi + echo -e "https://steamdb.info/app/${appid}/" + echo -en "\n" + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + if [ -n "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi + if [ -n "${betapassword}" ]; then + fn_script_log_info "Branch password: ${betapassword}" + fi + fi +} + +fn_appmanifest_info() { + appmanifestfile=$(find -L "${serverfiles}" -type f -name "appmanifest_${appid}.acf") + appmanifestfilewc=$(find -L "${serverfiles}" -type f -name "appmanifest_${appid}.acf" | wc -l) +} + +fn_appmanifest_check() { + fn_appmanifest_info + # Multiple or no matching appmanifest files may sometimes be present. + # This error is corrected if required. + if [ "${appmanifestfilewc}" -ge "2" ]; then + fn_print_error "Multiple appmanifest_${appid}.acf files found" + fn_script_log_error "Multiple appmanifest_${appid}.acf files found" + fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files" + for appfile in ${appmanifestfile}; do + rm -f "${appfile:?}" + done + appmanifestfilewc1="${appmanifestfilewc}" + fn_appmanifest_info + # if error can not be resolved. + if [ "${appmanifestfilewc}" -ge "2" ]; then + fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" + fn_script_log_fatal "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" + echo -e "* Check user permissions" + for appfile in ${appmanifestfile}; do + echo -e " ${appfile}" + done + core_exit.sh + else + fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" + fn_script_log_pass "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" + fn_print_info_nl "Forcing update to correct issue" + fn_script_log_info "Forcing update to correct issue" + fn_dl_steamcmd + fi + elif [ "${appmanifestfilewc}" -eq "0" ]; then + fn_print_error_nl "No appmanifest_${appid}.acf found" + fn_script_log_error "No appmanifest_${appid}.acf found" + fn_print_info_nl "Forcing update to correct issue" + fn_script_log_info "Forcing update to correct issue" + fn_dl_steamcmd + fn_appmanifest_info + if [ "${appmanifestfilewc}" -eq "0" ]; then + fn_print_fail_nl "Still no appmanifest_${appid}.acf found" + fn_script_log_fatal "Still no appmanifest_${appid}.acf found" + core_exit.sh + fi + fi +} diff --git a/lgsm/modules/core_trap.sh b/lgsm/modules/core_trap.sh new file mode 100644 index 000000000..ea6fce869 --- /dev/null +++ b/lgsm/modules/core_trap.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# LinuxGSM core_trap.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Handles CTRL-C trap to give an exit code. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +fn_exit_trap() { + if [ -z "${exitcode}" ]; then + exitcode=$? + fi + echo -e "" + if [ -z "${exitcode}" ]; then + exitcode=0 + fi + core_exit.sh +} + +# trap to give an exit code. +trap fn_exit_trap INT diff --git a/lgsm/functions/fix.sh b/lgsm/modules/fix.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/fix.sh rename to lgsm/modules/fix.sh index 57f6a91fa..322091f5a --- a/lgsm/functions/fix.sh +++ b/lgsm/modules/fix.sh @@ -3,10 +3,10 @@ # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: Overall function for managing fixes. -# Runs functions that will fix an issue. +# Description: Overall module for managing fixes. +# Runs modules that will fix an issue. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Messages that are displayed for some fixes. fn_fix_msg_start() { @@ -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/functions/fix_ark.sh b/lgsm/modules/fix_ark.sh old mode 100755 new mode 100644 similarity index 97% rename from lgsm/functions/fix_ark.sh rename to lgsm/modules/fix_ark.sh index f8e0447e3..7ca0e60f8 --- a/lgsm/functions/fix_ark.sh +++ b/lgsm/modules/fix_ark.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with ARK: Survival Evolved. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # removes mulitple appworkshop_346110.acf if found. steamappsfilewc="$(find "${HOME}" -name appworkshop_346110.acf | wc -l)" diff --git a/lgsm/functions/fix_arma3.sh b/lgsm/modules/fix_arma3.sh old mode 100755 new mode 100644 similarity index 89% rename from lgsm/functions/fix_arma3.sh rename to lgsm/modules/fix_arma3.sh index bbf14c9d2..d41738377 --- a/lgsm/functions/fix_arma3.sh +++ b/lgsm/modules/fix_arma3.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves an issue with ARMA3. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: 20150 Segmentation fault (core dumped) error. if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3" ] || [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Arma 3 - Other Profiles" ]; then diff --git a/lgsm/functions/fix_armar.sh b/lgsm/modules/fix_armar.sh similarity index 86% rename from lgsm/functions/fix_armar.sh rename to lgsm/modules/fix_armar.sh index 9db42f51a..2a56daf41 100755 --- a/lgsm/functions/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/functions/fix_av.sh b/lgsm/modules/fix_av.sh old mode 100755 new mode 100644 similarity index 90% rename from lgsm/functions/fix_av.sh rename to lgsm/modules/fix_av.sh index a61a8be65..c8fcdcfc5 --- a/lgsm/functions/fix_av.sh +++ b/lgsm/modules/fix_av.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves startup issue with Avorion -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" diff --git a/lgsm/functions/fix_bo.sh b/lgsm/modules/fix_bo.sh similarity index 81% rename from lgsm/functions/fix_bo.sh rename to lgsm/modules/fix_bo.sh index 453691874..3e09a880f 100644 --- a/lgsm/functions/fix_bo.sh +++ b/lgsm/modules/fix_bo.sh @@ -5,6 +5,6 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Ballistic Overkill. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/BODS_Data/Plugins/x86_64" diff --git a/lgsm/functions/fix_bt.sh b/lgsm/modules/fix_bt.sh similarity index 91% rename from lgsm/functions/fix_bt.sh rename to lgsm/modules/fix_bt.sh index 07fd61ce5..bb26155d8 100755 --- a/lgsm/functions/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/functions/fix_cmw.sh b/lgsm/modules/fix_cmw.sh old mode 100755 new mode 100644 similarity index 89% rename from lgsm/functions/fix_cmw.sh rename to lgsm/modules/fix_cmw.sh index 192f483e8..6b8f1caa8 --- a/lgsm/functions/fix_cmw.sh +++ b/lgsm/modules/fix_cmw.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves the issue of the not starting server on linux -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ ! -f "${executabledir}/steam_appid.txt" ]; then fixname="steam_appid.txt" diff --git a/lgsm/functions/fix_csgo.sh b/lgsm/modules/fix_csgo.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/fix_csgo.sh rename to lgsm/modules/fix_csgo.sh index a393f2fd9..eb8cc9560 --- a/lgsm/functions/fix_csgo.sh +++ b/lgsm/modules/fix_csgo.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with CS:GO. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: server not always creating steam_appid.txt file. if [ ! -f "${serverfiles}/steam_appid.txt" ]; then diff --git a/lgsm/functions/fix_dst.sh b/lgsm/modules/fix_dst.sh old mode 100755 new mode 100644 similarity index 91% rename from lgsm/functions/fix_dst.sh rename to lgsm/modules/fix_dst.sh index e30507dc9..e1f07dcb6 --- a/lgsm/functions/fix_dst.sh +++ b/lgsm/modules/fix_dst.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Don't Starve Together. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer). # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS. diff --git a/lgsm/functions/fix_hw.sh b/lgsm/modules/fix_hw.sh old mode 100755 new mode 100644 similarity index 81% rename from lgsm/functions/fix_hw.sh rename to lgsm/modules/fix_hw.sh index af06924db..6a92a5c04 --- a/lgsm/functions/fix_hw.sh +++ b/lgsm/modules/fix_hw.sh @@ -5,6 +5,6 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Hurtworld. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/Hurtworld_Data/Plugins/x86_64" diff --git a/lgsm/functions/fix_ins.sh b/lgsm/modules/fix_ins.sh old mode 100755 new mode 100644 similarity index 89% rename from lgsm/functions/fix_ins.sh rename to lgsm/modules/fix_ins.sh index 21a979c4c..21bea123a --- a/lgsm/functions/fix_ins.sh +++ b/lgsm/modules/fix_ins.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Insurgency. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: ./srcds_linux: error while loading shared libraries: libtier0.so: cannot open shared object file: No such file or directory. diff --git a/lgsm/functions/fix_kf.sh b/lgsm/modules/fix_kf.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/fix_kf.sh rename to lgsm/modules/fix_kf.sh index e749a2d27..3cfb8fd84 --- a/lgsm/functions/fix_kf.sh +++ b/lgsm/modules/fix_kf.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Killing Floor. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "Applying WebAdmin ROOst.css fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" diff --git a/lgsm/functions/fix_kf2.sh b/lgsm/modules/fix_kf2.sh old mode 100755 new mode 100644 similarity index 87% rename from lgsm/functions/fix_kf2.sh rename to lgsm/modules/fix_kf2.sh index b680a9937..7be311b4f --- a/lgsm/functions/fix_kf2.sh +++ b/lgsm/modules/fix_kf2.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Killing Floor 2. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" startparameters="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\"" diff --git a/lgsm/functions/fix_lo.sh b/lgsm/modules/fix_lo.sh similarity index 80% rename from lgsm/functions/fix_lo.sh rename to lgsm/modules/fix_lo.sh index eec2ebd36..a04248867 100644 --- a/lgsm/functions/fix_lo.sh +++ b/lgsm/modules/fix_lo.sh @@ -1,10 +1,10 @@ #!/bin/bash -# LinuxGSM fix_lo.sh function +# LinuxGSM fix_lo.sh module # Author: Daniel Gibbs # Website: https://linuxgsm.com # Description: Resolves installation issue with Last Oasis -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" appidfile=${executabledir}/steam_appid.txt if [ ! -f "${appidfile}" ]; then diff --git a/lgsm/functions/fix_mcb.sh b/lgsm/modules/fix_mcb.sh old mode 100755 new mode 100644 similarity index 84% rename from lgsm/functions/fix_mcb.sh rename to lgsm/modules/fix_mcb.sh index 4768a40cf..828225e72 --- a/lgsm/functions/fix_mcb.sh +++ b/lgsm/modules/fix_mcb.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves possible startup issue with Minecraft Bedrock. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # official docs state that the server should be started with: LD_LIBRARY_PATH=. ./bedrock_server export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_mta.sh b/lgsm/modules/fix_mta.sh old mode 100755 new mode 100644 similarity index 89% rename from lgsm/functions/fix_mta.sh rename to lgsm/modules/fix_mta.sh index 2c92e8d12..21292d7f3 --- a/lgsm/functions/fix_mta.sh +++ b/lgsm/modules/fix_mta.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Installs the libmysqlclient for database functions on the server. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then fixname="libmysqlclient16" diff --git a/lgsm/functions/fix_nmrih.sh b/lgsm/modules/fix_nmrih.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/fix_nmrih.sh rename to lgsm/modules/fix_nmrih.sh index 4bb70c6f9..83a5ad412 --- a/lgsm/functions/fix_nmrih.sh +++ b/lgsm/modules/fix_nmrih.sh @@ -6,7 +6,7 @@ # Description: Create symlinks for renamed No More Room In Hell serverfiles. # Solution from Steam Community post: https://steamcommunity.com/app/224260/discussions/2/1732089092441769414/ -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ln -s "${serverfiles}/bin/vphysics_srv.so" "${serverfiles}/bin/vphysics.so" ln -s "${serverfiles}/bin/studiorender_srv.so" "${serverfiles}/bin/studiorender.so" diff --git a/lgsm/functions/fix_onset.sh b/lgsm/modules/fix_onset.sh old mode 100755 new mode 100644 similarity index 91% rename from lgsm/functions/fix_onset.sh rename to lgsm/modules/fix_onset.sh index e4183999d..7d644ef7b --- a/lgsm/functions/fix_onset.sh +++ b/lgsm/modules/fix_onset.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Onset. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_ro.sh b/lgsm/modules/fix_ro.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/fix_ro.sh rename to lgsm/modules/fix_ro.sh index 895c7c2da..5dd1d3fb8 --- a/lgsm/functions/fix_ro.sh +++ b/lgsm/modules/fix_ro.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Red Orchestra. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "Applying WebAdmin ROOst.css fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" diff --git a/lgsm/functions/fix_rust.sh b/lgsm/modules/fix_rust.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/fix_rust.sh rename to lgsm/modules/fix_rust.sh index 5f407e89f..0699a8f00 --- a/lgsm/functions/fix_rust.sh +++ b/lgsm/modules/fix_rust.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves startup issue with Rust. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: [Raknet] Server Shutting Down (Shutting Down). export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/RustDedicated_Data/Plugins/x86_64" diff --git a/lgsm/functions/fix_rw.sh b/lgsm/modules/fix_rw.sh old mode 100755 new mode 100644 similarity index 80% rename from lgsm/functions/fix_rw.sh rename to lgsm/modules/fix_rw.sh index aef41a703..2cc631122 --- a/lgsm/functions/fix_rw.sh +++ b/lgsm/modules/fix_rw.sh @@ -5,6 +5,6 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Rising World. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" diff --git a/lgsm/functions/fix_samp.sh b/lgsm/modules/fix_samp.sh similarity index 94% rename from lgsm/functions/fix_samp.sh rename to lgsm/modules/fix_samp.sh index a88bf154f..146fc37af 100644 --- a/lgsm/functions/fix_samp.sh +++ b/lgsm/modules/fix_samp.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves issue that the default rcon password is not changed -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -f "${servercfgfullpath}" ]; then # check if default password is set "changeme" diff --git a/lgsm/functions/fix_sdtd.sh b/lgsm/modules/fix_sdtd.sh old mode 100755 new mode 100644 similarity index 81% rename from lgsm/functions/fix_sdtd.sh rename to lgsm/modules/fix_sdtd.sh index e93db7970..e46f7db8c --- a/lgsm/functions/fix_sdtd.sh +++ b/lgsm/modules/fix_sdtd.sh @@ -5,6 +5,6 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with 7 Days to Die. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}/7DaysToDieServer_Data/Plugins/x86_64" diff --git a/lgsm/functions/fix_sfc.sh b/lgsm/modules/fix_sfc.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/fix_sfc.sh rename to lgsm/modules/fix_sfc.sh index 51b95b9d5..891b71803 --- a/lgsm/functions/fix_sfc.sh +++ b/lgsm/modules/fix_sfc.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Source Forts Classic. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ ! -f "${serverfiles}/bin/datacache.so" ]; then ln -s "${serverfiles}/bin/datacache_srv.so" "${serverfiles}/bin/datacache.so" diff --git a/lgsm/functions/fix_sof2.sh b/lgsm/modules/fix_sof2.sh old mode 100755 new mode 100644 similarity index 82% rename from lgsm/functions/fix_sof2.sh rename to lgsm/modules/fix_sof2.sh index 002f42952..43d943cb1 --- a/lgsm/functions/fix_sof2.sh +++ b/lgsm/modules/fix_sof2.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Soldier of Fortune 2. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: error while loading shared libraries: libcxa.so.1 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_squad.sh b/lgsm/modules/fix_squad.sh similarity index 92% rename from lgsm/functions/fix_squad.sh rename to lgsm/modules/fix_squad.sh index 7d5929b5d..e7162d310 100644 --- a/lgsm/functions/fix_squad.sh +++ b/lgsm/modules/fix_squad.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Squad. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # As the server base dir changed for the game, we need to migrate the default config from the old to the new location oldservercfg="${serverfiles}/Squad/ServerConfig/${servercfg}" diff --git a/lgsm/functions/fix_st.sh b/lgsm/modules/fix_st.sh similarity index 84% rename from lgsm/functions/fix_st.sh rename to lgsm/modules/fix_st.sh index b9fb5b084..44066bb37 100644 --- a/lgsm/functions/fix_st.sh +++ b/lgsm/modules/fix_st.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves startup issue with Stationeers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: [Raknet] Server Shutting Down (Shutting Down). export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/rocketstation_DedicatedServer_Data/Plugins/x86_64" diff --git a/lgsm/functions/fix_steamcmd.sh b/lgsm/modules/fix_steamcmd.sh old mode 100755 new mode 100644 similarity index 98% rename from lgsm/functions/fix_steamcmd.sh rename to lgsm/modules/fix_steamcmd.sh index 9644208dc..44980ab32 --- a/lgsm/functions/fix_steamcmd.sh +++ b/lgsm/modules/fix_steamcmd.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues related to SteamCMD. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # function to simplify the steamclient.so fix # example diff --git a/lgsm/functions/fix_terraria.sh b/lgsm/modules/fix_terraria.sh old mode 100755 new mode 100644 similarity index 75% rename from lgsm/functions/fix_terraria.sh rename to lgsm/modules/fix_terraria.sh index 7758fdad9..7e5aa67e2 --- a/lgsm/functions/fix_terraria.sh +++ b/lgsm/modules/fix_terraria.sh @@ -5,6 +5,6 @@ # Website: https://linuxgsm.com # Description: Resolves an issue with Terraria. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export TERM=xterm diff --git a/lgsm/functions/fix_tf2.sh b/lgsm/modules/fix_tf2.sh old mode 100755 new mode 100644 similarity index 88% rename from lgsm/functions/fix_tf2.sh rename to lgsm/modules/fix_tf2.sh index 77e41a969..085542eed --- a/lgsm/functions/fix_tf2.sh +++ b/lgsm/modules/fix_tf2.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Team Fortress 2. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: Team Fortress 2 Segmentation fault for Red-Hat Distros #2062. if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/libcurl-gnutls.so.4" ]; then diff --git a/lgsm/functions/fix_ts3.sh b/lgsm/modules/fix_ts3.sh old mode 100755 new mode 100644 similarity index 94% rename from lgsm/functions/fix_ts3.sh rename to lgsm/modules/fix_ts3.sh index 7c7387cb6..9eb728f48 --- a/lgsm/functions/fix_ts3.sh +++ b/lgsm/modules/fix_ts3.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Teamspeak 3. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: makes libmariadb2 available #1924. if [ ! -f "${serverfiles}/libmariadb.so.2" ]; then diff --git a/lgsm/functions/fix_unt.sh b/lgsm/modules/fix_unt.sh old mode 100755 new mode 100644 similarity index 81% rename from lgsm/functions/fix_unt.sh rename to lgsm/modules/fix_unt.sh index eae2e6313..77253bd85 --- a/lgsm/functions/fix_unt.sh +++ b/lgsm/modules/fix_unt.sh @@ -5,6 +5,6 @@ # Website: https://linuxgsm.com # Description: Resolves startup issue with Unturned. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/Unturned_Headless_Data/Plugins/x86_64" diff --git a/lgsm/functions/fix_ut.sh b/lgsm/modules/fix_ut.sh old mode 100755 new mode 100644 similarity index 83% rename from lgsm/functions/fix_ut.sh rename to lgsm/modules/fix_ut.sh index 2e6686a8d..aa958e86d --- a/lgsm/functions/fix_ut.sh +++ b/lgsm/modules/fix_ut.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Unreal Tournament. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" #Set Binary Executable echo -e "chmod +x ${executabledir}/${executable}" diff --git a/lgsm/functions/fix_ut2k4.sh b/lgsm/modules/fix_ut2k4.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/fix_ut2k4.sh rename to lgsm/modules/fix_ut2k4.sh index 49610e4b6..0a3b89b33 --- a/lgsm/functions/fix_ut2k4.sh +++ b/lgsm/modules/fix_ut2k4.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Unreal Tournament 2004. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "applying WebAdmin ut2003.css fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" diff --git a/lgsm/functions/fix_ut3.sh b/lgsm/modules/fix_ut3.sh old mode 100755 new mode 100644 similarity index 91% rename from lgsm/functions/fix_ut3.sh rename to lgsm/modules/fix_ut3.sh index 6bd26a53a..4958537f2 --- a/lgsm/functions/fix_ut3.sh +++ b/lgsm/modules/fix_ut3.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Unreal Tournament 3. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" startparameters="server VCTF-Suspense?Game=UTGameContent.UTVehicleCTFGame_Content?bIsDedicated=true?bIsLanMatch=false?bUsesStats=false?bShouldAdvertise=false?PureServer=1?bAllowJoinInProgress=true?ConfigSubDir=${selfname} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}" diff --git a/lgsm/functions/fix_vh.sh b/lgsm/modules/fix_vh.sh old mode 100755 new mode 100644 similarity index 92% rename from lgsm/functions/fix_vh.sh rename to lgsm/modules/fix_vh.sh index a90c5d0b0..984907747 --- a/lgsm/functions/fix_vh.sh +++ b/lgsm/modules/fix_vh.sh @@ -1,10 +1,10 @@ #!/bin/bash -# LinuxGSM fix_rust.sh function +# LinuxGSM fix_rust.sh module # Author: Alasdair Haig # Website: https://linuxgsm.com # Description: Resolves startup issue with Valheim -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH diff --git a/lgsm/functions/fix_wurm.sh b/lgsm/modules/fix_wurm.sh old mode 100755 new mode 100644 similarity index 87% rename from lgsm/functions/fix_wurm.sh rename to lgsm/modules/fix_wurm.sh index aba24d382..1536df2e7 --- a/lgsm/functions/fix_wurm.sh +++ b/lgsm/modules/fix_wurm.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Wurm Unlimited. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # First run requires start with no parms. # After first run new dirs are created. diff --git a/lgsm/functions/fix_zmr.sh b/lgsm/modules/fix_zmr.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/fix_zmr.sh rename to lgsm/modules/fix_zmr.sh index 491c36638..56f055fc3 --- a/lgsm/functions/fix_zmr.sh +++ b/lgsm/modules/fix_zmr.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Zombie Master: Reborn. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ ! -f "${serverfiles}/bin/datacache.so" ]; then ln -s "${serverfiles}/bin/datacache_srv.so" "${serverfiles}/bin/datacache.so" diff --git a/lgsm/functions/info_distro.sh b/lgsm/modules/info_distro.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/info_distro.sh rename to lgsm/modules/info_distro.sh index f29e621d5..411a50458 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/modules/info_distro.sh @@ -6,7 +6,7 @@ # Description: Variables providing useful info on the Operating System such as disk and performace info. # Used for command_details.sh, command_debug.sh and alert.sh. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Game Server pid if [ "${status}" == "1" ]; then diff --git a/lgsm/functions/info_game.sh b/lgsm/modules/info_game.sh similarity index 99% rename from lgsm/functions/info_game.sh rename to lgsm/modules/info_game.sh index 8c9ca310a..59e8d37fa 100644 --- a/lgsm/functions/info_game.sh +++ b/lgsm/modules/info_game.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Gathers various game server information. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ## Examples of filtering to get info from config files. # sed 's/foo//g' - remove foo diff --git a/lgsm/functions/info_messages.sh b/lgsm/modules/info_messages.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/info_messages.sh rename to lgsm/modules/info_messages.sh index 5478987f1..4dbbdcd96 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/modules/info_messages.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Defines server info messages for details and alerts. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Separator is different for details. fn_messages_separator() { diff --git a/lgsm/functions/info_stats.sh b/lgsm/modules/info_stats.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/info_stats.sh rename to lgsm/modules/info_stats.sh index 0589770f6..2afe3338d --- a/lgsm/functions/info_stats.sh +++ b/lgsm/modules/info_stats.sh @@ -6,7 +6,7 @@ # Description: Collect optional Stats sent to LinuxGSM project. # Uses Google analytics. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_distro.sh diff --git a/lgsm/functions/install_complete.sh b/lgsm/modules/install_complete.sh old mode 100755 new mode 100644 similarity index 86% rename from lgsm/functions/install_complete.sh rename to lgsm/modules/install_complete.sh index ad258b224..58189a4be --- a/lgsm/functions/install_complete.sh +++ b/lgsm/modules/install_complete.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Prints installation completion message and hints. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "=================================" diff --git a/lgsm/functions/install_config.sh b/lgsm/modules/install_config.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/install_config.sh rename to lgsm/modules/install_config.sh index 35d7df7c6..699a919c3 --- a/lgsm/functions/install_config.sh +++ b/lgsm/modules/install_config.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Creates default server configs. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Checks if server cfg dir exists, creates it if it doesn't. fn_check_cfgdir() { diff --git a/lgsm/functions/install_dst_token.sh b/lgsm/modules/install_dst_token.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/install_dst_token.sh rename to lgsm/modules/install_dst_token.sh index 50bc7ed97..43db58fab --- a/lgsm/functions/install_dst_token.sh +++ b/lgsm/modules/install_dst_token.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Configures Don't Starve Together cluster with given token. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Enter ${gamename} Cluster Token${default}" diff --git a/lgsm/functions/install_eula.sh b/lgsm/modules/install_eula.sh old mode 100755 new mode 100644 similarity index 95% rename from lgsm/functions/install_eula.sh rename to lgsm/modules/install_eula.sh index 3e51fac71..d70ca7d31 --- a/lgsm/functions/install_eula.sh +++ b/lgsm/modules/install_eula.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Gets user to accept the EULA. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${shortname}" == "ts3" ]; then eulaurl="https://www.teamspeak.com/en/privacy-and-terms" diff --git a/lgsm/functions/install_factorio_save.sh b/lgsm/modules/install_factorio_save.sh old mode 100755 new mode 100644 similarity index 86% rename from lgsm/functions/install_factorio_save.sh rename to lgsm/modules/install_factorio_save.sh index f5fdb8a04..c86ee2f37 --- a/lgsm/functions/install_factorio_save.sh +++ b/lgsm/modules/install_factorio_save.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Creates the initial save file for Factorio. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Creating initial Factorio savefile${default}" diff --git a/lgsm/functions/install_gslt.sh b/lgsm/modules/install_gslt.sh old mode 100755 new mode 100644 similarity index 96% rename from lgsm/functions/install_gslt.sh rename to lgsm/modules/install_gslt.sh index 1ae1ef3b0..e2224276f --- a/lgsm/functions/install_gslt.sh +++ b/lgsm/modules/install_gslt.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Configures GSLT. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Game Server Login Token${default}" diff --git a/lgsm/functions/install_header.sh b/lgsm/modules/install_header.sh old mode 100755 new mode 100644 similarity index 91% rename from lgsm/functions/install_header.sh rename to lgsm/modules/install_header.sh index 4cf067f8f..b52e116e7 --- a/lgsm/functions/install_header.sh +++ b/lgsm/modules/install_header.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Prints installation header. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" clear fn_print_ascii_logo diff --git a/lgsm/functions/install_logs.sh b/lgsm/modules/install_logs.sh old mode 100755 new mode 100644 similarity index 97% rename from lgsm/functions/install_logs.sh rename to lgsm/modules/install_logs.sh index 80a55fb94..31a408506 --- a/lgsm/functions/install_logs.sh +++ b/lgsm/modules/install_logs.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Creates log directories. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${checklogs}" != "1" ]; then echo -e "" diff --git a/lgsm/functions/install_mta_resources.sh b/lgsm/modules/install_mta_resources.sh old mode 100755 new mode 100644 similarity index 88% rename from lgsm/functions/install_mta_resources.sh rename to lgsm/modules/install_mta_resources.sh index 011ad9b71..bafdbdbf1 --- a/lgsm/functions/install_mta_resources.sh +++ b/lgsm/modules/install_mta_resources.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Installs the libmysqlclient for database functions on the server and optionally installs default resources required to run the server. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_information_nl "${gamename} will not function without resources!" echo -e " * install default resources using ./${selfname} install-default-resources" diff --git a/lgsm/functions/install_retry.sh b/lgsm/modules/install_retry.sh old mode 100755 new mode 100644 similarity index 82% rename from lgsm/functions/install_retry.sh rename to lgsm/modules/install_retry.sh index a36b4fb38..1fc4bf36a --- a/lgsm/functions/install_retry.sh +++ b/lgsm/modules/install_retry.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Asks for installation retry after failure. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if fn_prompt_yn "Retry install?" Y; then command_install.sh diff --git a/lgsm/functions/install_server_dir.sh b/lgsm/modules/install_server_dir.sh old mode 100755 new mode 100644 similarity index 89% rename from lgsm/functions/install_server_dir.sh rename to lgsm/modules/install_server_dir.sh index 658f4360c..08e83dce6 --- a/lgsm/functions/install_server_dir.sh +++ b/lgsm/modules/install_server_dir.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Creates the server directory. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Server Directory${default}" diff --git a/lgsm/functions/install_server_files.sh b/lgsm/modules/install_server_files.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/install_server_files.sh rename to lgsm/modules/install_server_files.sh index 80075a76a..717030df4 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/modules/install_server_files.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Installs server files. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_server_files() { if [ "${shortname}" == "ahl" ]; then diff --git a/lgsm/functions/install_squad_license.sh b/lgsm/modules/install_squad_license.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/install_squad_license.sh rename to lgsm/modules/install_squad_license.sh index 181646e85..58053e134 --- a/lgsm/functions/install_squad_license.sh +++ b/lgsm/modules/install_squad_license.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Configures the Squad server's license. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Squad Server License${default}" diff --git a/lgsm/functions/install_stats.sh b/lgsm/modules/install_stats.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/install_stats.sh rename to lgsm/modules/install_stats.sh index d3b45b40b..8c65c007c --- a/lgsm/functions/install_stats.sh +++ b/lgsm/modules/install_stats.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Enabled LinuxGSM Stats. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}LinuxGSM Stats${default}" diff --git a/lgsm/functions/install_steamcmd.sh b/lgsm/modules/install_steamcmd.sh old mode 100755 new mode 100644 similarity index 83% rename from lgsm/functions/install_steamcmd.sh rename to lgsm/modules/install_steamcmd.sh index b1e64a42c..8eeb2de53 --- a/lgsm/functions/install_steamcmd.sh +++ b/lgsm/modules/install_steamcmd.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Downloads SteamCMD on install. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Installing SteamCMD${default}" diff --git a/lgsm/functions/install_ts3db.sh b/lgsm/modules/install_ts3db.sh old mode 100755 new mode 100644 similarity index 97% rename from lgsm/functions/install_ts3db.sh rename to lgsm/modules/install_ts3db.sh index ed879cd28..703f9b645 --- a/lgsm/functions/install_ts3db.sh +++ b/lgsm/modules/install_ts3db.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Installs the database server MariaDB for TeamSpeak 3. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_ts3db_mariadb() { if [ ! -f "${serverfiles}/libts3db_mariadb.so" ]; then diff --git a/lgsm/functions/install_ut2k4_key.sh b/lgsm/modules/install_ut2k4_key.sh old mode 100755 new mode 100644 similarity index 93% rename from lgsm/functions/install_ut2k4_key.sh rename to lgsm/modules/install_ut2k4_key.sh index 124052d05..c09c4590c --- a/lgsm/functions/install_ut2k4_key.sh +++ b/lgsm/modules/install_ut2k4_key.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Activates ut2k4 server with given key. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Enter ${gamename} CD Key${default}" diff --git a/lgsm/functions/mods_core.sh b/lgsm/modules/mods_core.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/mods_core.sh rename to lgsm/modules/mods_core.sh index 8e4ade771..2078ae167 --- a/lgsm/functions/mods_core.sh +++ b/lgsm/modules/mods_core.sh @@ -3,9 +3,9 @@ # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com -# Description: Core functions for mods list/install/update/remove +# Description: Core modules for mods list/install/update/remove -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Files and Directories. modsdir="${lgsmdir}/mods" diff --git a/lgsm/functions/mods_list.sh b/lgsm/modules/mods_list.sh old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/mods_list.sh rename to lgsm/modules/mods_list.sh index a83b7e303..e093124e9 --- a/lgsm/functions/mods_list.sh +++ b/lgsm/modules/mods_list.sh @@ -8,7 +8,7 @@ # Usage: Then add this array to the mods_global_array. # Usage: If needed, you can scrape the download URL first. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Get a proper URL for mods that don't provide a good one (optional) fn_script_log_info "Retrieving latest mods URLs" diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/modules/query_gamedig.sh old mode 100755 new mode 100644 similarity index 97% rename from lgsm/functions/query_gamedig.sh rename to lgsm/modules/query_gamedig.sh index 265607acd..bbf24f5d7 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/modules/query_gamedig.sh @@ -6,7 +6,7 @@ # Description: Querys a gameserver using node-gamedig. # https://github.com/sonicsnes/node-gamedig -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" querystatus="2" # 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/functions/query_gsquery.py b/lgsm/modules/query_gsquery.py old mode 100755 new mode 100644 similarity index 99% rename from lgsm/functions/query_gsquery.py rename to lgsm/modules/query_gsquery.py index 62c92082e..09bb147d9 --- a/lgsm/functions/query_gsquery.py +++ b/lgsm/modules/query_gsquery.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -# LinuxGSM query_gsquery.py function +# LinuxGSM query_gsquery.py module # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com diff --git a/lgsm/functions/update_factorio.sh b/lgsm/modules/update_factorio.sh similarity index 98% rename from lgsm/functions/update_factorio.sh rename to lgsm/modules/update_factorio.sh index 548d53b15..2d58f0cf9 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/modules/update_factorio.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Factorio servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles diff --git a/lgsm/functions/update_jediknight2.sh b/lgsm/modules/update_jediknight2.sh similarity index 98% rename from lgsm/functions/update_jediknight2.sh rename to lgsm/modules/update_jediknight2.sh index 7560f0158..8a6cd9bfc 100644 --- a/lgsm/functions/update_jediknight2.sh +++ b/lgsm/modules/update_jediknight2.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Jedi Knight 2 servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/modules/update_minecraft.sh similarity index 98% rename from lgsm/functions/update_minecraft.sh rename to lgsm/modules/update_minecraft.sh index ace4713bc..69dc118b1 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/modules/update_minecraft.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Minecraft: Java Edition servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/modules/update_minecraft_bedrock.sh similarity index 98% rename from lgsm/functions/update_minecraft_bedrock.sh rename to lgsm/modules/update_minecraft_bedrock.sh index cf61e3a2b..a0d76aa20 100644 --- a/lgsm/functions/update_minecraft_bedrock.sh +++ b/lgsm/modules/update_minecraft_bedrock.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Minecraft Bedrock servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "bedrock_server.${remotebuildversion}.zip" diff --git a/lgsm/functions/update_mta.sh b/lgsm/modules/update_mta.sh similarity index 98% rename from lgsm/functions/update_mta.sh rename to lgsm/modules/update_mta.sh index 5252c1328..16b8278c7 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/modules/update_mta.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Multi Theft Auto servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to tmpdir. diff --git a/lgsm/functions/update_papermc.sh b/lgsm/modules/update_papermc.sh similarity index 98% rename from lgsm/functions/update_papermc.sh rename to lgsm/modules/update_papermc.sh index f48a66e39..447f8808a 100644 --- a/lgsm/functions/update_papermc.sh +++ b/lgsm/modules/update_papermc.sh @@ -1,11 +1,11 @@ #!/bin/bash -# LinuxGSM update_papermc.sh function +# LinuxGSM update_papermc.sh module # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com # Description: Handles updating of PaperMC and Waterfall 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/lgsm/functions/update_steamcmd.sh b/lgsm/modules/update_steamcmd.sh similarity index 87% rename from lgsm/functions/update_steamcmd.sh rename to lgsm/modules/update_steamcmd.sh index eb773f016..401da43a8 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/modules/update_steamcmd.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating using SteamCMD. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # init steamcmd functions core_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/functions/update_ts3.sh b/lgsm/modules/update_ts3.sh similarity index 98% rename from lgsm/functions/update_ts3.sh rename to lgsm/modules/update_ts3.sh index e76609b2d..dc79090ed 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/modules/update_ts3.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Teamspeak 3 servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles diff --git a/lgsm/functions/update_ut99.sh b/lgsm/modules/update_ut99.sh similarity index 98% rename from lgsm/functions/update_ut99.sh rename to lgsm/modules/update_ut99.sh index b6db783e2..a1dc2b3dd 100644 --- a/lgsm/functions/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/lgsm/functions/update_vintagestory.sh b/lgsm/modules/update_vintagestory.sh old mode 100755 new mode 100644 similarity index 98% rename from lgsm/functions/update_vintagestory.sh rename to lgsm/modules/update_vintagestory.sh index 84e3192c9..946b6ed0b --- a/lgsm/functions/update_vintagestory.sh +++ b/lgsm/modules/update_vintagestory.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Vintage Story servers. -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles diff --git a/linuxgsm.sh b/linuxgsm.sh index 3d8b7f376..dd7d51bb3 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -32,7 +32,7 @@ logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" -functionsdir="${lgsmdir}/functions" +modulesdir="${lgsmdir}/modules" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" lockdir="${lgsmdir}/lock" @@ -57,14 +57,14 @@ if [ ! "$(command -v curl 2> /dev/null)" ]; then exit 1 fi -# Core function that is required first. -core_functions.sh() { - functionfile="${FUNCNAME[0]}" - fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5" +# Core module that is required first. +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 functions required before passed off to core_dl.sh. +# Fetches the core modules required before passed off to core_dl.sh. fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" @@ -183,7 +183,7 @@ fn_bootstrap_fetch_file_github() { run="${5:-0}" forcedl="${6:-0}" md5="${7:-0}" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } @@ -327,11 +327,11 @@ if [ "$(whoami)" == "root" ] && [ ! -f /.dockerenv ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then + 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 - core_functions.sh + core_modules.sh check_root.sh fi fi @@ -377,7 +377,7 @@ if [ "${shortname}" == "core" ]; then # LinuxGSM server mode. else - core_functions.sh + core_modules.sh if [ "${shortname}" != "core-dep" ]; then # Load LinuxGSM configs. # These are required to get all the default variables for the specific server. @@ -397,8 +397,8 @@ else echo -e "OK" fi else - function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") - if [ "${function_file_diff}" != "" ]; then + config_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") + if [ "${config_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has altered. reloading config." echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index b9ca2789a..97981c0cc 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -32,7 +32,7 @@ logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" -functionsdir="${lgsmdir}/functions" +modulesdir="${lgsmdir}/modules" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" lockdir="${lgsmdir}/lock" @@ -51,20 +51,20 @@ if [ -z "${TRAVIS}" ]; then fi travistest="1" ## GitHub Branch Select -# Allows for the use of different function files +# Allows for the use of different module files # from a different repo and/or branch. githubuser="GameServerManagers" githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" -# Core function that is required first. -core_functions.sh() { - functionfile="${FUNCNAME[0]}" - fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" +# Core module that is required first. +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 functions required before passed off to core_dl.sh. +# Fetches the core modules required before passed off to core_dl.sh. fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" @@ -183,7 +183,7 @@ fn_bootstrap_fetch_file_github() { run="${5:-0}" forcedl="${6:-0}" md5="${7:-0}" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } @@ -327,11 +327,11 @@ if [ "$(whoami)" == "root" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then + 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 - core_functions.sh + core_modules.sh check_root.sh fi fi @@ -377,7 +377,7 @@ if [ "${shortname}" == "core" ]; then # LinuxGSM server mode. else - core_functions.sh + core_modules.sh if [ "${shortname}" != "core-dep" ]; then # Load LinuxGSM configs. # These are required to get all the default variables for the specific server. @@ -398,8 +398,8 @@ else echo -e "OK" fi else - function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") - if [ "${function_file_diff}" != "" ]; then + module_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") + if [ "${module_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has been altered. reloading config." echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" @@ -636,7 +636,7 @@ echo -e "" ) echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "0.2 - Enable dev-debug" @@ -653,7 +653,7 @@ echo -e "" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.0 - Pre-install tests" @@ -681,7 +681,7 @@ fi echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.2 - getopt" @@ -699,7 +699,7 @@ echo -e "" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.3 - getopt with incorrect args" @@ -718,7 +718,7 @@ getopt="abc123" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "2.0 - Installation" @@ -739,7 +739,7 @@ echo -e "Command: ./${gameservername} auto-install" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.0 - Start/Stop/Restart Tests" @@ -762,7 +762,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.2 - start - online" @@ -781,7 +781,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.3 - start - updateonstart" @@ -801,7 +801,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.4 - stop" @@ -820,7 +820,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.5 - stop - offline" @@ -839,7 +839,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.6 - restart" @@ -858,7 +858,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.7 - restart - offline" @@ -877,7 +877,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.0 - Update Tests" @@ -900,7 +900,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.2 - update-lgsm" @@ -920,7 +920,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.0 - Monitor Tests" @@ -947,7 +947,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.2 - monitor - offline - with lockfile" @@ -970,7 +970,7 @@ echo "${port}" >> "${lockdir}/${selfname}.lock" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.3 - monitor - offline - no lockfile" @@ -989,7 +989,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.4 - test-alert" @@ -1008,7 +1008,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "6.0 - Details Tests" @@ -1031,7 +1031,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "6.2 - postdetails" @@ -1050,7 +1050,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "7.0 - Backup Tests" @@ -1069,7 +1069,7 @@ echo -e "test de-activated until issue #1839 fixed" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.0 - Development Tools Tests" @@ -1092,7 +1092,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.2 - dev - detect ldd" @@ -1111,7 +1111,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.3 - dev - detect deps" @@ -1130,7 +1130,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.4 - dev - query-raw" @@ -1149,7 +1149,7 @@ fn_setstatus fn_test_result_na echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" @@ -1173,7 +1173,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "=================================" diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 5c2787086..57dd28cc8 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -32,7 +32,7 @@ logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" -functionsdir="${lgsmdir}/functions" +modulesdir="${lgsmdir}/modules" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" lockdir="${lgsmdir}/lock" @@ -52,20 +52,20 @@ fi travistest="1" ## GitHub Branch Select -# Allows for the use of different function files +# Allows for the use of different module files # from a different repo and/or branch. githubuser="GameServerManagers" githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" -# Core function that is required first. -core_functions.sh() { - functionfile="${FUNCNAME[0]}" - fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" +# Core module that is required first. +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 functions required before passed off to core_dl.sh. +# Fetches the core modules required before passed off to core_dl.sh. fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" @@ -184,7 +184,7 @@ fn_bootstrap_fetch_file_github() { run="${5:-0}" forcedl="${6:-0}" md5="${7:-0}" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } @@ -328,11 +328,11 @@ if [ "$(whoami)" == "root" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then + 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 - core_functions.sh + core_modules.sh check_root.sh fi fi @@ -378,7 +378,7 @@ if [ "${shortname}" == "core" ]; then # LinuxGSM server mode. else - core_functions.sh + core_modules.sh if [ "${shortname}" != "core-dep" ]; then # Load LinuxGSM configs. # These are required to get all the default variables for the specific server. @@ -399,8 +399,8 @@ else echo -e "OK" fi else - function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") - if [ "${function_file_diff}" != "" ]; then + module_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") + if [ "${module_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has been altered. reloading config." echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" @@ -641,7 +641,7 @@ echo -e "" ) echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "0.2 - Enable dev-debug" @@ -658,7 +658,7 @@ echo -e "" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.0 - Pre-install tests" @@ -686,7 +686,7 @@ fi echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.2 - getopt" @@ -704,7 +704,7 @@ echo -e "" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.3 - getopt with incorrect args" @@ -723,7 +723,7 @@ getopt="abc123" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "2.0 - Installation" @@ -744,7 +744,7 @@ echo -e "Command: ./${gameservername} auto-install" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.0 - Start/Stop/Restart Tests" @@ -767,7 +767,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.2 - start - online" @@ -786,7 +786,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.3 - start - updateonstart" @@ -806,7 +806,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.4 - stop" @@ -825,7 +825,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.5 - stop - offline" @@ -844,7 +844,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.6 - restart" @@ -863,7 +863,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.7 - restart - offline" @@ -882,7 +882,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.0 - Update Tests" @@ -905,7 +905,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.2 - update - change buildid" @@ -926,7 +926,7 @@ sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.3 - update - change buildid - online" @@ -947,7 +947,7 @@ sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.4 - update - remove appmanifest file" @@ -968,7 +968,7 @@ rm --verbose "${serverfiles:?}/steamapps/appmanifest_${appid}.acf" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.5 - force-update" @@ -988,7 +988,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.6 - force-update - online" @@ -1008,7 +1008,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.7 - validate" @@ -1027,7 +1027,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.8 - validate - online" @@ -1047,7 +1047,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.9 - update-lgsm" @@ -1067,7 +1067,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "Inserting IP address" @@ -1108,7 +1108,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.2 - monitor - offline - with lockfile" @@ -1131,7 +1131,7 @@ echo "${port}" >> "${lockdir}/${selfname}.lock" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.3 - monitor - offline - no lockfile" @@ -1150,7 +1150,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.4 - test-alert" @@ -1171,7 +1171,7 @@ sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" fn_print_info_nl "Re-generating ${servercfg}." @@ -1199,7 +1199,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "6.2 - postdetails" @@ -1218,7 +1218,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "7.0 - Backup Tests" @@ -1237,7 +1237,7 @@ echo -e "test de-activated until issue #1839 fixed" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.0 - Development Tools Tests" @@ -1260,7 +1260,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.2 - dev - detect ldd" @@ -1279,7 +1279,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.3 - dev - detect deps" @@ -1298,7 +1298,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.4 - dev - query-raw" @@ -1317,7 +1317,7 @@ fn_setstatus fn_test_result_na echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "9.0 - Sponsor" @@ -1340,7 +1340,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "=================================" diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index 05676ad2f..a32ffd8f5 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -32,7 +32,7 @@ logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" -functionsdir="${lgsmdir}/functions" +modulesdir="${lgsmdir}/modules" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" lockdir="${lgsmdir}/lock" @@ -52,20 +52,20 @@ fi travistest="1" ## GitHub Branch Select -# Allows for the use of different function files +# Allows for the use of different module files # from a different repo and/or branch. githubuser="GameServerManagers" githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" -# Core function that is required first. -core_functions.sh() { - functionfile="${FUNCNAME[0]}" - fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" +# Core module that is required first. +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 functions required before passed off to core_dl.sh. +# Fetches the core modules required before passed off to core_dl.sh. fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" @@ -184,7 +184,7 @@ fn_bootstrap_fetch_file_github() { run="${5:-0}" forcedl="${6:-0}" md5="${7:-0}" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } @@ -328,11 +328,11 @@ if [ "$(whoami)" == "root" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then + 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 - core_functions.sh + core_modules.sh check_root.sh fi fi @@ -378,7 +378,7 @@ if [ "${shortname}" == "core" ]; then # LinuxGSM server mode. else - core_functions.sh + core_modules.sh if [ "${shortname}" != "core-dep" ]; then # Load LinuxGSM configs. # These are required to get all the default variables for the specific server. @@ -399,8 +399,8 @@ else echo -e "OK" fi else - function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") - if [ "${function_file_diff}" != "" ]; then + module_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") + if [ "${module_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has been altered. reloading config." echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" @@ -635,7 +635,7 @@ echo -e "" ) echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "0.2 - Enable dev-debug" @@ -652,7 +652,7 @@ echo -e "" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.0 - Pre-install tests" @@ -680,7 +680,7 @@ fi echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.2 - getopt" @@ -698,7 +698,7 @@ echo -e "" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.3 - getopt with incorrect args" @@ -717,7 +717,7 @@ getopt="abc123" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "2.0 - Installation" @@ -738,7 +738,7 @@ echo -e "Command: ./${gameservername} auto-install" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.0 - Start/Stop/Restart Tests" @@ -761,7 +761,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.2 - start - online" @@ -780,7 +780,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.3 - start - updateonstart" @@ -800,7 +800,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "30s Pause" echo -e "=================================" @@ -828,7 +828,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.5 - stop - offline" @@ -847,7 +847,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.6 - restart" @@ -866,7 +866,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.7 - restart - offline" @@ -885,7 +885,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.0 - Update Tests" @@ -908,7 +908,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.2 - update-lgsm" @@ -928,7 +928,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "Inserting IP address" @@ -979,7 +979,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.2 - monitor - offline - with lockfile" @@ -1002,7 +1002,7 @@ echo "${port}" >> "${lockdir}/${selfname}.lock" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.3 - monitor - offline - no lockfile" @@ -1021,7 +1021,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.4 - test-alert" @@ -1040,7 +1040,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "6.0 - Details Tests" @@ -1063,7 +1063,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "6.2 - postdetails" @@ -1082,7 +1082,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "7.0 - Backup Tests" @@ -1101,7 +1101,7 @@ echo -e "test de-activated until issue #1839 fixed" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.0 - Development Tools Tests" @@ -1124,7 +1124,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.2 - dev - detect ldd" @@ -1143,7 +1143,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.3 - dev - detect deps" @@ -1162,7 +1162,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "Inserting IP address" @@ -1195,7 +1195,7 @@ fn_setstatus fn_test_result_na echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "9.0 - Sponsor" @@ -1218,7 +1218,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "=================================" diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index 1f553fd51..7d7ed7180 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -32,7 +32,7 @@ logdir="${rootdir}/log" lgsmlogdir="${logdir}/lgsm" steamcmddir="${HOME}/.steam/steamcmd" serverfiles="${rootdir}/serverfiles" -functionsdir="${lgsmdir}/functions" +modulesdir="${lgsmdir}/modules" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" lockdir="${lgsmdir}/lock" @@ -52,20 +52,20 @@ fi travistest="1" ## GitHub Branch Select -# Allows for the use of different function files +# Allows for the use of different module files # from a different repo and/or branch. githubuser="GameServerManagers" githubrepo="LinuxGSM" githubbranch="${TRAVIS_BRANCH}" -# Core function that is required first. -core_functions.sh() { - functionfile="${FUNCNAME[0]}" - fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" +# Core module that is required first. +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 functions required before passed off to core_dl.sh. +# Fetches the core modules required before passed off to core_dl.sh. fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" @@ -184,7 +184,7 @@ fn_bootstrap_fetch_file_github() { run="${5:-0}" forcedl="${6:-0}" md5="${7:-0}" - # Passes vars to the file download function. + # Passes vars to the file download module. fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } @@ -328,11 +328,11 @@ if [ "$(whoami)" == "root" ]; then echo -e "[ FAIL ] Do NOT run this script as root!" exit 1 fi - elif [ ! -f "${functionsdir}/core_functions.sh" ] || [ ! -f "${functionsdir}/check_root.sh" ] || [ ! -f "${functionsdir}/core_messages.sh" ]; then + 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 - core_functions.sh + core_modules.sh check_root.sh fi fi @@ -378,7 +378,7 @@ if [ "${shortname}" == "core" ]; then # LinuxGSM server mode. else - core_functions.sh + core_modules.sh if [ "${shortname}" != "core-dep" ]; then # Load LinuxGSM configs. # These are required to get all the default variables for the specific server. @@ -399,8 +399,8 @@ else echo -e "OK" fi else - function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") - if [ "${function_file_diff}" != "" ]; then + module_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg") + if [ "${module_file_diff}" != "" ]; then fn_print_warn_nl "_default.cfg has been altered. reloading config." echo -en "copying _default.cfg...\c" cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg" @@ -635,7 +635,7 @@ echo -e "" ) echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "0.2 - Enable dev-debug" @@ -652,7 +652,7 @@ echo -e "" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.0 - Pre-install tests" @@ -680,7 +680,7 @@ fi echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.2 - getopt" @@ -698,7 +698,7 @@ echo -e "" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "1.3 - getopt with incorrect args" @@ -717,7 +717,7 @@ getopt="abc123" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "2.0 - Installation" @@ -738,7 +738,7 @@ echo -e "Command: ./${gameservername} auto-install" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.0 - Start/Stop/Restart Tests" @@ -761,7 +761,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.2 - start - online" @@ -780,7 +780,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.3 - start - updateonstart" @@ -800,7 +800,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.4 - stop" @@ -819,7 +819,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.5 - stop - offline" @@ -838,7 +838,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.6 - restart" @@ -857,7 +857,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "3.7 - restart - offline" @@ -876,7 +876,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.0 - Update Tests" @@ -899,7 +899,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "4.2 - update-lgsm" @@ -919,7 +919,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.0 - Monitor Tests" @@ -946,7 +946,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.2 - monitor - offline - with lockfile" @@ -969,7 +969,7 @@ echo "${port}" >> "${lockdir}/${selfname}.lock" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.3 - monitor - offline - no lockfile" @@ -988,7 +988,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "5.4 - test-alert" @@ -1007,7 +1007,7 @@ fn_setstatus fn_test_result_fail echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "6.0 - Details Tests" @@ -1030,7 +1030,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "6.2 - postdetails" @@ -1049,7 +1049,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "7.0 - Backup Tests" @@ -1068,7 +1068,7 @@ echo -e "test de-activated until issue #1839 fixed" fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.0 - Development Tools Tests" @@ -1091,7 +1091,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.2 - dev - detect ldd" @@ -1110,7 +1110,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.3 - dev - detect deps" @@ -1129,7 +1129,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "8.4 - dev - query-raw" @@ -1148,7 +1148,7 @@ fn_setstatus fn_test_result_na echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "9.0 - Sponsor" @@ -1171,7 +1171,7 @@ fn_setstatus fn_test_result_pass echo -e "run order" echo -e "=================" -grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g' +grep modulefile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/modulefile=//g' echo -e "" echo -e "================================="