From 66bf5e059e96ec8445fa5ee877c525292364b5cb Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 3 May 2020 00:02:21 +0100 Subject: [PATCH] feat(log): refactor log handling (#2859) * standardise module identifiers * renamed logs.sh to core_logs.sh * improve stats log * remove local * functionselfname rename --- lgsm/functions/alert.sh | 43 +++++++++--------- lgsm/functions/alert_discord.sh | 4 +- lgsm/functions/alert_email.sh | 4 +- lgsm/functions/alert_ifttt.sh | 4 +- lgsm/functions/alert_mailgun.sh | 4 +- lgsm/functions/alert_pushbullet.sh | 4 +- lgsm/functions/alert_pushover.sh | 4 +- lgsm/functions/alert_slack.sh | 4 +- lgsm/functions/alert_telegram.sh | 4 +- lgsm/functions/check.sh | 44 +++++++++---------- lgsm/functions/check_config.sh | 3 +- lgsm/functions/check_deps.sh | 16 +++---- lgsm/functions/check_executable.sh | 3 +- lgsm/functions/check_glibc.sh | 2 +- lgsm/functions/check_ip.sh | 14 +++--- lgsm/functions/check_last_update.sh | 2 + lgsm/functions/check_logs.sh | 3 +- lgsm/functions/check_permissions.sh | 4 +- lgsm/functions/check_root.sh | 5 +-- lgsm/functions/check_status.sh | 3 +- lgsm/functions/check_steamcmd.sh | 10 ++--- lgsm/functions/check_system_dir.sh | 5 +-- lgsm/functions/check_system_requirements.sh | 3 +- lgsm/functions/check_tmuxception.sh | 2 +- lgsm/functions/command_backup.sh | 6 +-- lgsm/functions/command_console.sh | 6 +-- lgsm/functions/command_debug.sh | 6 +-- lgsm/functions/command_details.sh | 6 +-- lgsm/functions/command_dev_clear_functions.sh | 6 +++ lgsm/functions/command_dev_debug.sh | 6 +-- lgsm/functions/command_dev_detect_deps.sh | 12 ++--- lgsm/functions/command_dev_detect_glibc.sh | 8 ++-- lgsm/functions/command_dev_detect_ldd.sh | 6 +-- lgsm/functions/command_dev_query_raw.sh | 6 +-- lgsm/functions/command_donate.sh | 6 +-- lgsm/functions/command_fastdl.sh | 8 ++-- lgsm/functions/command_install.sh | 6 +-- .../command_install_resources_mta.sh | 6 +-- lgsm/functions/command_mods_install.sh | 6 +-- lgsm/functions/command_mods_remove.sh | 6 +-- lgsm/functions/command_mods_update.sh | 6 +-- lgsm/functions/command_monitor.sh | 23 +++++----- lgsm/functions/command_postdetails.sh | 34 +++++++------- lgsm/functions/command_restart.sh | 6 +-- lgsm/functions/command_start.sh | 8 ++-- lgsm/functions/command_stop.sh | 6 +-- lgsm/functions/command_test_alert.sh | 6 +-- lgsm/functions/command_ts3_server_pass.sh | 6 +-- lgsm/functions/command_update.sh | 8 ++-- lgsm/functions/command_update_functions.sh | 13 ------ lgsm/functions/command_update_linuxgsm.sh | 6 +-- lgsm/functions/command_validate.sh | 6 +-- lgsm/functions/command_wipe.sh | 6 +-- lgsm/functions/compress_unreal2_maps.sh | 5 ++- lgsm/functions/compress_ut99_maps.sh | 5 ++- lgsm/functions/core_dl.sh | 6 +-- lgsm/functions/core_exit.sh | 16 ++++--- lgsm/functions/core_functions.sh | 4 +- lgsm/functions/core_getopt.sh | 2 +- lgsm/functions/core_legacy.sh | 2 + lgsm/functions/{logs.sh => core_logs.sh} | 7 ++- lgsm/functions/core_messages.sh | 26 ++++++----- lgsm/functions/core_trap.sh | 2 + lgsm/functions/fix.sh | 7 ++- lgsm/functions/fix_ark.sh | 2 + lgsm/functions/fix_arma3.sh | 4 +- lgsm/functions/fix_av.sh | 3 +- lgsm/functions/fix_csgo.sh | 4 +- lgsm/functions/fix_dst.sh | 4 +- lgsm/functions/fix_ges.sh | 3 +- lgsm/functions/fix_hw.sh | 2 + lgsm/functions/fix_ins.sh | 5 +-- lgsm/functions/fix_kf.sh | 4 +- lgsm/functions/fix_kf2.sh | 4 +- lgsm/functions/fix_mcb.sh | 3 +- lgsm/functions/fix_mta.sh | 4 +- lgsm/functions/fix_nmrih.sh | 3 +- lgsm/functions/fix_onset.sh | 4 +- lgsm/functions/fix_ro.sh | 4 +- lgsm/functions/fix_rust.sh | 3 +- lgsm/functions/fix_rw.sh | 3 +- lgsm/functions/fix_sdtd.sh | 3 +- lgsm/functions/fix_sfc.sh | 4 +- lgsm/functions/fix_sof2.sh | 4 +- lgsm/functions/fix_ss3.sh | 4 +- lgsm/functions/fix_steamcmd.sh | 4 +- lgsm/functions/fix_terraria.sh | 4 +- lgsm/functions/fix_tf2.sh | 4 +- lgsm/functions/fix_ts3.sh | 4 +- lgsm/functions/fix_tu.sh | 2 + lgsm/functions/fix_unt.sh | 3 +- lgsm/functions/fix_ut.sh | 4 +- lgsm/functions/fix_ut2k4.sh | 4 +- lgsm/functions/fix_ut3.sh | 4 +- lgsm/functions/fix_wurm.sh | 3 +- lgsm/functions/fix_zmr.sh | 4 +- lgsm/functions/info_config.sh | 2 +- lgsm/functions/info_distro.sh | 2 +- lgsm/functions/info_messages.sh | 6 ++- lgsm/functions/info_parms.sh | 2 +- lgsm/functions/install_complete.sh | 4 +- lgsm/functions/install_config.sh | 4 +- lgsm/functions/install_dst_token.sh | 4 +- lgsm/functions/install_eula.sh | 4 +- lgsm/functions/install_factorio_save.sh | 3 +- lgsm/functions/install_gslt.sh | 4 +- lgsm/functions/install_header.sh | 4 +- lgsm/functions/install_logs.sh | 4 +- lgsm/functions/install_mta_resources.sh | 4 +- lgsm/functions/install_retry.sh | 4 +- lgsm/functions/install_server_dir.sh | 4 +- lgsm/functions/install_server_files.sh | 4 +- lgsm/functions/install_squad_license.sh | 4 +- lgsm/functions/install_stats.sh | 4 +- lgsm/functions/install_steamcmd.sh | 3 +- lgsm/functions/install_ts3db.sh | 4 +- lgsm/functions/install_ut2k4_key.sh | 4 +- lgsm/functions/mods_core.sh | 4 +- lgsm/functions/mods_list.sh | 4 +- lgsm/functions/query_gamedig.sh | 2 + lgsm/functions/update_factorio.sh | 4 +- lgsm/functions/update_minecraft.sh | 4 +- lgsm/functions/update_minecraft_bedrock.sh | 4 +- lgsm/functions/update_mta.sh | 4 +- lgsm/functions/update_mumble.sh | 4 +- lgsm/functions/update_steamcmd.sh | 6 +-- lgsm/functions/update_ts3.sh | 4 +- linuxgsm.sh | 1 + 128 files changed, 322 insertions(+), 427 deletions(-) rename lgsm/functions/{logs.sh => core_logs.sh} (95%) diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh index f76500105..5f8fe156e 100644 --- a/lgsm/functions/alert.sh +++ b/lgsm/functions/alert.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Overall function for managing alerts. -local modulename="ALERT" -local commandaction="Alert" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_alert_log(){ info_distro.sh @@ -100,23 +99,23 @@ fn_alert_log if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then exitbypass=1 command_postdetails.sh -elif [ "${postalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${postalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "More Info not enabled" fn_script_log_warn "More Info alerts not enabled" -elif [ -z "${posttarget}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${posttarget}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "posttarget not set" fn_script_error "posttarget not set" -elif [ -z "${postdays}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${postdays}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "postdays not set" fn_script_error "postdays not set" fi if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then alert_discord.sh -elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${discordalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Discord alerts not enabled" fn_script_log_warn "Discord alerts not enabled" -elif [ -z "${discordtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${discordtoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Discord token not set" echo -e "* https://docs.linuxgsm.com/alerts/discord" fn_script_error "Discord token not set" @@ -124,20 +123,20 @@ fi if [ "${emailalert}" == "on" ]&&[ -n "${email}" ]; then alert_email.sh -elif [ "${emailalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${emailalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Email alerts not enabled" fn_script_log_warn "Email alerts not enabled" -elif [ -z "${email}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${email}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Email not set" fn_script_log_error "Email not set" fi if [ "${iftttalert}" == "on" ]&&[ -n "${iftttalert}" ]; then alert_ifttt.sh -elif [ "${iftttalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${iftttalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "IFTTT alerts not enabled" fn_script_log_warn "IFTTT alerts not enabled" -elif [ -z "${ifttttoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${ifttttoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "IFTTT token not set" echo -e "* https://docs.linuxgsm.com/alerts/ifttt" fn_script_error "IFTTT token not set" @@ -145,10 +144,10 @@ fi if [ "${mailgunalert}" == "on" ]&&[ -n "${mailgunalert}" ]; then alert_mailgun.sh -elif [ "${mailgunalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${mailgunalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Mailgun alerts not enabled" fn_script_log_warn "Mailgun alerts not enabled" -elif [ -z "${mailguntoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${mailguntoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Mailgun token not set" echo -e "* https://docs.linuxgsm.com/alerts/mailgun" fn_script_error "Mailgun token not set" @@ -156,10 +155,10 @@ fi if [ "${pushbulletalert}" == "on" ]&&[ -n "${pushbullettoken}" ]; then alert_pushbullet.sh -elif [ "${pushbulletalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${pushbulletalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Pushbullet alerts not enabled" fn_script_log_warn "Pushbullet alerts not enabled" -elif [ -z "${pushbullettoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${pushbullettoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Pushbullet token not set" echo -e "* https://docs.linuxgsm.com/alerts/pushbullet" fn_script_error "Pushbullet token not set" @@ -167,10 +166,10 @@ fi if [ "${pushoveralert}" == "on" ]&&[ -n "${pushoveralert}" ]; then alert_pushover.sh -elif [ "${pushoveralert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${pushoveralert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Pushover alerts not enabled" fn_script_log_warn "Pushover alerts not enabled" -elif [ -z "${pushovertoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${pushovertoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Pushover token not set" echo -e "* https://docs.linuxgsm.com/alerts/pushover" fn_script_error "Pushover token not set" @@ -178,14 +177,14 @@ fi if [ "${telegramalert}" == "on" ]&&[ -n "${telegramtoken}" ]; then alert_telegram.sh -elif [ "${telegramalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${telegramalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Telegram Messages not enabled" fn_script_log_warn "Telegram Messages not enabled" -elif [ -z "${telegramtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${telegramtoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Telegram token not set." echo -e "* https://docs.linuxgsm.com/alerts/telegram" fn_script_error "Telegram token not set." -elif [ -z "${telegramchatid}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${telegramchatid}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Telegram chat id not set." echo -e "* https://docs.linuxgsm.com/alerts/telegram" fn_script_error "Telegram chat id not set." @@ -193,10 +192,10 @@ fi if [ "${slackalert}" == "on" ]&&[ -n "${slackalert}" ]; then alert_slack.sh -elif [ "${slackalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ "${slackalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_warn_nl "Slack alerts not enabled" fn_script_log_warn "Slack alerts not enabled" -elif [ -z "${slacktoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then +elif [ -z "${slacktoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then fn_print_error_nl "Slack token not set" echo -e "* https://docs.linuxgsm.com/alerts/slack" fn_script_error "Slack token not set" diff --git a/lgsm/functions/alert_discord.sh b/lgsm/functions/alert_discord.sh index c088df281..3ed12fe97 100644 --- a/lgsm/functions/alert_discord.sh +++ b/lgsm/functions/alert_discord.sh @@ -5,9 +5,7 @@ # Website: https://linuxgsm.com # Description: Sends Discord alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if ! command -v jq > /dev/null; then fn_print_fail_nl "Sending Discord alert: jq is missing." diff --git a/lgsm/functions/alert_email.sh b/lgsm/functions/alert_email.sh index 398ecc3e8..f69f8f408 100644 --- a/lgsm/functions/alert_email.sh +++ b/lgsm/functions/alert_email.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Sends email alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "Sending Email alert: ${email}" fn_sleep_time diff --git a/lgsm/functions/alert_ifttt.sh b/lgsm/functions/alert_ifttt.sh index 0e983e2dc..376dfed3a 100644 --- a/lgsm/functions/alert_ifttt.sh +++ b/lgsm/functions/alert_ifttt.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Sends IFTTT alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$(cat < /dev/null; then fn_print_fail_nl "Sending Slack alert: jq is missing." diff --git a/lgsm/functions/alert_telegram.sh b/lgsm/functions/alert_telegram.sh index 90e2708f3..33662b756 100644 --- a/lgsm/functions/alert_telegram.sh +++ b/lgsm/functions/alert_telegram.sh @@ -4,9 +4,7 @@ # Website: https://bytegaming.de # Description: Sends Telegram Messenger alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$(cat </dev/null | grep -Ecx "^${selfname}") diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index 1c99e282e..b8dbffd87 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -4,7 +4,7 @@ # Website: https://linuxgsm.com # Description: Checks if SteamCMD is installed correctly. -local modulename="CHECK" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_steamcmd(){ if [ ${shortname} == "ark" ]&&[ "${installsteamcmd}" == "1" ]; then @@ -50,14 +50,14 @@ 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 [ "${function_selfname}" == "command_install.sh" ]; 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 [ "${function_selfname}" == "command_install.sh" ]; then + elif [ "${commandname}" == "INSTALL" ]; then fn_print_information "SteamCMD is already installed..." fn_print_ok_eol_nl fi @@ -110,14 +110,14 @@ fn_check_steamcmd_ark(){ # to allow ark mods to work if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then installsteamcmd=1 - if [ "${function_selfname}" == "command_install.sh" ]; then + 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 [ "${function_selfname}" == "command_install.sh" ]; then + elif [ "${commandname}" == "INSTALL" ]; then fn_print_information "ARK mods SteamCMD is already installed..." fn_print_ok_eol_nl fi diff --git a/lgsm/functions/check_system_dir.sh b/lgsm/functions/check_system_dir.sh index 9a4863a5a..ce7ff5ba5 100644 --- a/lgsm/functions/check_system_dir.sh +++ b/lgsm/functions/check_system_dir.sh @@ -4,10 +4,9 @@ # Website: https://linuxgsm.com # Description: Checks if systemdir/serverfiles is accessible. -local modulename="CHECK" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -if [ "${function_selfname}" != "command_validate.sh" ]; then +if [ "${commandname}" != "VALIDATE" ]; then checkdir="${serverfiles}" else checkdir="${systemdir}" diff --git a/lgsm/functions/check_system_requirements.sh b/lgsm/functions/check_system_requirements.sh index 139b2b6af..8b7db5a3c 100644 --- a/lgsm/functions/check_system_requirements.sh +++ b/lgsm/functions/check_system_requirements.sh @@ -5,8 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks RAM requirements -local modulename="CHECK" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_distro.sh diff --git a/lgsm/functions/check_tmuxception.sh b/lgsm/functions/check_tmuxception.sh index 06cb40de1..4f5fd2e29 100644 --- a/lgsm/functions/check_tmuxception.sh +++ b/lgsm/functions/check_tmuxception.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Checks if run from tmux or screen -local modulename="CHECK" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_check_is_in_tmux(){ if [ "${TMUX}" ]; then diff --git a/lgsm/functions/command_backup.sh b/lgsm/functions/command_backup.sh index d4befa46c..7666156d4 100644 --- a/lgsm/functions/command_backup.sh +++ b/lgsm/functions/command_backup.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Creates a .tar.gz file in the backup directory. -local modulename="BACKUP" -local commandaction="Backup" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="BACKUP" +commandaction="Backing up" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh diff --git a/lgsm/functions/command_console.sh b/lgsm/functions/command_console.sh index 16578600c..c3e3257be 100644 --- a/lgsm/functions/command_console.sh +++ b/lgsm/functions/command_console.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Gives access to the server tmux console. -local modulename="CONSOLE" -local commandaction="Console" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="CONSOLE" +commandaction="Access console" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh fn_print_header diff --git a/lgsm/functions/command_debug.sh b/lgsm/functions/command_debug.sh index 9da7ae95c..5aeb0d5e1 100644 --- a/lgsm/functions/command_debug.sh +++ b/lgsm/functions/command_debug.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Runs the server without tmux and directly from the terminal. -local modulename="DEBUG" -local commandaction="Debug" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="DEBUG" +commandaction="Debuging" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Trap to remove lockfile on quit. fn_lockfile_trap(){ diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index 02726f197..c2abc0ba0 100644 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Displays server information. -local modulename="DETAILS" -local commandaction="Details" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="DETAILS" +commandaction="Viewing details" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Run checks and gathers details to display. check.sh diff --git a/lgsm/functions/command_dev_clear_functions.sh b/lgsm/functions/command_dev_clear_functions.sh index 51878a381..0c2faa375 100644 --- a/lgsm/functions/command_dev_clear_functions.sh +++ b/lgsm/functions/command_dev_clear_functions.sh @@ -4,6 +4,10 @@ # Website: https://linuxgsm.com # Description: Deletes the contents of the functions dir. +commandname="DEV-CLEAR-MODULES" +commandaction="Clearing modules" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + echo -e "=================================" echo -e "Clear Functions" echo -e "=================================" @@ -11,6 +15,8 @@ echo -e "" if fn_prompt_yn "Do you want to delete all functions?" Y; then rm -rfv "${functionsdir:?}/"* rm -rfv "${configdirdefault:?}/"* + fn_script_log_info "Cleared modules directory" + fn_script_log_info "Cleared default config directory" fi core_exit.sh diff --git a/lgsm/functions/command_dev_debug.sh b/lgsm/functions/command_dev_debug.sh index f17b67fe2..962b01e7f 100644 --- a/lgsm/functions/command_dev_debug.sh +++ b/lgsm/functions/command_dev_debug.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Dev only: Enables debugging log to be saved to dev-debug.log. -local modulename="DEV-DEBUG" -local commandaction="Dev Debug" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="DEV-DEBUG" +commandaction="Developer debug" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -f "${rootdir}/.dev-debug" ]; then rm "${rootdir:?}/.dev-debug" diff --git a/lgsm/functions/command_dev_detect_deps.sh b/lgsm/functions/command_dev_detect_deps.sh index 79770044d..04f37d696 100644 --- a/lgsm/functions/command_dev_detect_deps.sh +++ b/lgsm/functions/command_dev_detect_deps.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Detects dependencies the server binary requires. -local modulename="DETECT-DEPS" -local commandaction="Detect Deps" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="DEV-DETECT-DEPS" +commandaction="Developer detect deps" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "=================================" echo -e "Dependencies Checker" @@ -40,7 +40,7 @@ touch "${tmpdir}/.depdetect_debian_list" while read -r lib; do echo -e "${lib}" - local libs_array=( libm.so.6 libc.so.6 libtcmalloc_minimal.so.4 libpthread.so.0 libdl.so.2 libnsl.so.1 libgcc_s.so.1 librt.so.1 ld-linux.so.2 libdbus-glib-1.so.2 libgio-2.0.so.0 libglib-2.0.so.0 libGL.so.1 libgobject-2.0.so.0 libnm-glib.so.4 libnm-util.so.2 ) + libs_array=( libm.so.6 libc.so.6 libtcmalloc_minimal.so.4 libpthread.so.0 libdl.so.2 libnsl.so.1 libgcc_s.so.1 librt.so.1 ld-linux.so.2 libdbus-glib-1.so.2 libgio-2.0.so.0 libglib-2.0.so.0 libGL.so.1 libgobject-2.0.so.0 libnm-glib.so.4 libnm-util.so.2 ) for lib_file in "${libs_array[@]}" do if [ "${lib}" == "${lib_file}" ]; then @@ -51,7 +51,7 @@ while read -r lib; do fi done - local libs_array=( libawt.so libjava.so libjli.so libjvm.so libnet.so libnio.so libverify.so ) + libs_array=( libawt.so libjava.so libjli.so libjvm.so libnet.so libnio.so libverify.so ) for lib_file in "${libs_array[@]}" do if [ "${lib}" == "${lib_file}" ]; then @@ -62,7 +62,7 @@ while read -r lib; do fi done - local libs_array=( libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so) + libs_array=( libtier0.so libtier0_srv.so libvstdlib_srv.so Core.so libvstdlib.so libtier0_s.so Editor.so Engine.so liblua.so libsteam_api.so ld-linux-x86-64.so.2 libPhysX3_x86.so libPhysX3Common_x86.so libPhysX3Cooking_x86.so) for lib_file in "${libs_array[@]}" do # Known shared libs what dont requires dependencies. diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh index 49d7cc55a..2289bb818 100644 --- a/lgsm/functions/command_dev_detect_glibc.sh +++ b/lgsm/functions/command_dev_detect_glibc.sh @@ -5,9 +5,9 @@ # Description: Automatically detects the version of GLIBC that is required. # Can check a file or directory recursively. -local modulename="DETECT-GLIBC" -local commandaction="Detect Glibc" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="DEV-DETECT-GLIBC" +commandaction="Developer detect glibc" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "=================================" echo -e "glibc Requirements Checker" @@ -33,7 +33,7 @@ fi echo -e "" -local glibc_check_dir_array=( steamcmddir serverfiles ) +glibc_check_dir_array=( steamcmddir serverfiles ) for glibc_check_var in "${glibc_check_dir_array[@]}" do if [ "${glibc_check_var}" == "serverfiles" ]; then diff --git a/lgsm/functions/command_dev_detect_ldd.sh b/lgsm/functions/command_dev_detect_ldd.sh index 919900de1..850845179 100644 --- a/lgsm/functions/command_dev_detect_ldd.sh +++ b/lgsm/functions/command_dev_detect_ldd.sh @@ -5,9 +5,9 @@ # Description: Automatically detects required deps using ldd. # Can check a file or directory recursively. -local modulename="DETECT-LDD" -local commandaction="Detect LDD" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="DEV-DETECT-LDD" +commandaction="Developer detect ldd" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "=================================" echo -e "Shared Object dependencies Checker" diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/functions/command_dev_query_raw.sh index 0f5e5c8e2..cdd539ce9 100644 --- a/lgsm/functions/command_dev_query_raw.sh +++ b/lgsm/functions/command_dev_query_raw.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Raw gamedig output of the server. -local modulename="QUERY-RAW" -local commandaction="Query Raw" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="DEV-QUERY-RAW" +commandaction="Developer query raw" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh info_config.sh diff --git a/lgsm/functions/command_donate.sh b/lgsm/functions/command_donate.sh index 726ac1b60..9bb7f2faf 100644 --- a/lgsm/functions/command_donate.sh +++ b/lgsm/functions/command_donate.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Shows ways to donate. -local modulename="CONSOLE" -local commandaction="Console" -local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") +commandname="DONATE" +commandaction="Donate" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_ascii_logo echo -e "${lightyellow}Support LinuxGSM${default}" diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh index 4e0007fd8..335d02d9d 100644 --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/functions/command_fastdl.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Creates a FastDL directory. -local modulename="FASTDL" -local commandaction="FastDL" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="FASTDL" +commandaction="Fastdl" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh @@ -135,7 +135,7 @@ fn_human_readable_file_size(){ local factor="${item%:*}" local abbrev="${item#*:}" if [[ "${bytes}" -ge "${factor}" ]]; then - local size=$(bc -l <<< "${bytes} / ${factor}") + size=$(bc -l <<< "${bytes} / ${factor}") printf "%.*f %s\n" "${precision}" "${size}" "${abbrev}" break fi diff --git a/lgsm/functions/command_install.sh b/lgsm/functions/command_install.sh index 65b22de70..9a6b64e98 100644 --- a/lgsm/functions/command_install.sh +++ b/lgsm/functions/command_install.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Overall function for the installer. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="INSTALL" +commandaction="Installing" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh if [ "$(whoami)" = "root" ]; then diff --git a/lgsm/functions/command_install_resources_mta.sh b/lgsm/functions/command_install_resources_mta.sh index 3d75824f7..0a9ac7806 100644 --- a/lgsm/functions/command_install_resources_mta.sh +++ b/lgsm/functions/command_install_resources_mta.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Installs the default resources for Multi Theft Auto. -local modulename="DEFAULT_RESOURCES" -local commandaction="Default Resources" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="DEFAULT-RESOURCES" +commandaction="Default Resources" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_resources(){ echo -e "" diff --git a/lgsm/functions/command_mods_install.sh b/lgsm/functions/command_mods_install.sh index 971db3314..d3c517461 100644 --- a/lgsm/functions/command_mods_install.sh +++ b/lgsm/functions/command_mods_install.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: List and installs available mods along with mods_list.sh and mods_core.sh. -local modulename="MODS" -local commandaction="addons/mods" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="MODS-INSTALL" +commandaction="Installing mods" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh mods_core.sh diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/functions/command_mods_remove.sh index 61289b60e..a8149e07b 100644 --- a/lgsm/functions/command_mods_remove.sh +++ b/lgsm/functions/command_mods_remove.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Uninstall mods along with mods_list.sh and mods_core.sh. -local modulename="MODS" -local commandaction="Mods Remove" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="MODS-REMOVE" +commandaction="Removing mods" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh mods_core.sh diff --git a/lgsm/functions/command_mods_update.sh b/lgsm/functions/command_mods_update.sh index 44ff4d9b4..165b4ea98 100644 --- a/lgsm/functions/command_mods_update.sh +++ b/lgsm/functions/command_mods_update.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Updates installed mods along with mods_list.sh and mods_core.sh. -local modulename="MODS" -local commandaction="Mods Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="MODS-UPDATE" +commandaction="Updating mods" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh mods_core.sh diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index 98f018cf4..1df51768f 100644 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -6,9 +6,9 @@ # Description: Monitors server by checking for running processes # then passes to gamedig and gsquery. -local modulename="MONITOR" -local commandaction="Monitor" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="MONITOR" +commandaction="Monitoring" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_monitor_check_lockfile(){ # Monitor does not run it lockfile is not found. @@ -141,11 +141,7 @@ for queryattempt in {1..5}; do fn_script_log_pass "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt}: OK" fn_sleep_time monitorpass=1 - # send LinuxGSM stats if monitor is OK. - if [ "${stats}" == "on" ]||[ "${stats}" == "y" ]; then - info_stats.sh - fi - if [ "${querystatus}" == "0" ]; then + if [ "${querystatus}" == "0" ]; then # Add query data to log. if [ "${gdname}" ]; then fn_script_log_info "Server name: ${gdname}" @@ -154,14 +150,19 @@ for queryattempt in {1..5}; do fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}" fi if [ "${gdbots}" ]; then - fn_script_log_info "Bots: ${gdbots}" - fi + fn_script_log_info "Bots: ${gdbots}" + fi if [ "${gdmap}" ]; then fn_script_log_info "Map: ${gdmap}" fi if [ "${gdgamemode}" ]; then fn_script_log_info "Game Mode: ${gdgamemode}" fi + + # send LinuxGSM stats if monitor is OK. + if [ "${stats}" == "on" ]||[ "${stats}" == "y" ]; then + info_stats.sh + fi fi core_exit.sh else @@ -239,7 +240,7 @@ fn_monitor_loop(){ monitorflag=1 check.sh -logs.sh +core_logs.sh info_config.sh info_parms.sh diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index b62cc708a..a0afa2905 100644 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Strips sensitive information out of Details output -local modulename="POSTDETAILS" -local commandaction="Postdetails" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="POST-DETAILS" +commandaction="Posting details" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Set posttarget to the appropriately-defined post destination. @@ -74,14 +74,13 @@ else fn_info_message_ports fn_info_message_select_engine fn_info_message_statusbottom - } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${postdetailslog}" > /dev/null 2>&1 + } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a "${postdetailslog}" > /dev/null 2>&1 fi - +# Pastebin if [ "${posttarget}" == "http://pastebin.com" ] ; then fn_print_dots "pastbin.com for ${postexpire}" # grab the return from 'value' from an initial visit to pastebin. - csrftoken=$(curl -s "${posttarget}" | - sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') + csrftoken=$(curl -s "${posttarget}" | sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p') # # Use the csrftoken to then post the content. # @@ -94,9 +93,9 @@ if [ "${posttarget}" == "http://pastebin.com" ] ; then # Output the resulting link. fn_print_ok_nl "pastbin.com for ${postexpire}" + fn_script_log_pass "pastbin.com for ${postexpire}" pdurl="${posttarget}${link}" - echo -e "" - echo -e " Please share the following url for support: ${pdurl}" +# Hastebin elif [ "${posttarget}" == "https://hastebin.com" ] ; then fn_print_dots "hastebin.com" # hastebin is a bit simpler. If successful, the returned result @@ -104,21 +103,20 @@ elif [ "${posttarget}" == "https://hastebin.com" ] ; then # we need in "key". TODO - error handling. -CedarLUG link=$(curl -H "HTTP_X_REQUESTED_WITH:XMLHttpRequest" -s -d "$(<${postdetailslog})" "${posttarget}/documents" | cut -d\" -f4) fn_print_ok_nl "hastebin.com for ${postexpire}" + fn_script_log_pass "hastebin.com for ${postexpire}" pdurl="${posttarget}/${link}" - echo -e "" - echo -e "Please share the following url for support: ${pdurl}" +# Termbin elif [ "${posttarget}" == "https://termbin.com" ] ; then fn_print_dots "termbin.com" link=$(cat "${postdetailslog}" | nc termbin.com 9999 | tr -d '\n\0') - fn_print_ok_nl "termbin.com" + fn_print_ok_nl "termbin.com for 30D" + fn_script_log_pass "termbin.com for 30D" pdurl="${link}" - echo -e "" - echo -e "Please share the following url for support: " - echo -e "${pdurl}" -else - fn_print_warn_nl "Review output in: ${postdetailslog}" - core_exit.sh fi +echo -e "" +echo -e "Please share the following url for support: " +echo -e "${pdurl}" +fn_script_log_info "${pdurl}" if [ -z "${exitbypass}" ]; then core_exit.sh diff --git a/lgsm/functions/command_restart.sh b/lgsm/functions/command_restart.sh index c127d21b4..8a08c04ff 100644 --- a/lgsm/functions/command_restart.sh +++ b/lgsm/functions/command_restart.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Restarts the server. -local modulename="RESTART" -local commandaction="Restarting" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="MODS-INSTALL" +commandaction="Restarting" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" info_config.sh exitbypass=1 diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh index d1ee21e42..497ca215a 100644 --- a/lgsm/functions/command_start.sh +++ b/lgsm/functions/command_start.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Starts the server. -local modulename="START" -local commandaction="Starting" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="START" +commandaction="Starting" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_start_teamspeak3(){ if [ ! -f "${servercfgfullpath}" ]; then @@ -183,7 +183,7 @@ if [ -z "${fixbypass}" ]; then fix.sh fi info_config.sh -logs.sh +core_logs.sh # Will check for updates is updateonstart is yes. if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index c25714de2..3a27ba8d8 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Stops the server. -local modulename="STOP" -local commandaction="Stopping" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="STOP" +commandaction="Stopping" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Attempts graceful shutdown by sending 'CTRL+c'. fn_stop_graceful_ctrlc(){ diff --git a/lgsm/functions/command_test_alert.sh b/lgsm/functions/command_test_alert.sh index b921babe1..5d1c11885 100644 --- a/lgsm/functions/command_test_alert.sh +++ b/lgsm/functions/command_test_alert.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Sends a test alert. -local modulename="ALERT" -local commandaction="Alert" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="TEST-ALERT" +commandaction="Sending Alert" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "${servername}" check.sh diff --git a/lgsm/functions/command_ts3_server_pass.sh b/lgsm/functions/command_ts3_server_pass.sh index 91d19afeb..8ff799e6e 100644 --- a/lgsm/functions/command_ts3_server_pass.sh +++ b/lgsm/functions/command_ts3_server_pass.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Changes TS3 serveradmin password. -local modulename="PASSWORD-CHANGE" -local commandaction="Password Change" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="CHANGE-PASSWORD" +commandaction="Changing password" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_serveradmin_password_prompt(){ fn_print_header diff --git a/lgsm/functions/command_update.sh b/lgsm/functions/command_update.sh index f54423be4..88109a147 100644 --- a/lgsm/functions/command_update.sh +++ b/lgsm/functions/command_update.sh @@ -4,13 +4,13 @@ # Website: https://linuxgsm.com # Description: Handles updating of servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="UPDATE" +commandaction="Updating" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "" check.sh -logs.sh +core_logs.sh check_last_update.sh if [ "${shortname}" == "ts3" ]; then diff --git a/lgsm/functions/command_update_functions.sh b/lgsm/functions/command_update_functions.sh index e325b781a..e69de29bb 100644 --- a/lgsm/functions/command_update_functions.sh +++ b/lgsm/functions/command_update_functions.sh @@ -1,13 +0,0 @@ -#!/bin/bash -# LinuxGSM command_update_functions.sh function -# Author: Daniel Gibbs -# Website: https://linuxgsm.com -# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. -# Legacy Command - -command_update_linuxgsm.sh(){ -functionfile="${FUNCNAME[0]}" -fn_fetch_function -} - -command_update_linuxgsm.sh diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh index d141c0659..90c2f0446 100644 --- a/lgsm/functions/command_update_linuxgsm.sh +++ b/lgsm/functions/command_update_linuxgsm.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Deletes the functions dir to allow re-downloading of functions from GitHub. -local modulename="UPDATE LINUXGSM" -local commandaction="Update LinuxGSM" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="UPDATE-LGSM" +commandaction="Updating LinuxGSM" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "Updating LinuxGSM" check.sh diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index 09b7f23b7..5ddf5ffde 100644 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -4,9 +4,9 @@ # Website: https://linuxgsm.com # Description: Runs a server validation. -local modulename="VALIDATE" -local commandaction="Validate" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="VALIDATE" +commandaction="Validating" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_validate(){ fn_script_log_warn "Validating server: SteamCMD: Validate might overwrite some customised files" diff --git a/lgsm/functions/command_wipe.sh b/lgsm/functions/command_wipe.sh index 55e636b07..5b5abf552 100644 --- a/lgsm/functions/command_wipe.sh +++ b/lgsm/functions/command_wipe.sh @@ -5,9 +5,9 @@ # Website: https://linuxgsm.com # Description: Wipes server data, useful after updates for some games like Rust -local modulename="WIPE" -local commandaction="Wipe" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="WIPE" +commandaction="Wiping" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh fn_print_header diff --git a/lgsm/functions/compress_unreal2_maps.sh b/lgsm/functions/compress_unreal2_maps.sh index 99078bfc7..3580c20c9 100644 --- a/lgsm/functions/compress_unreal2_maps.sh +++ b/lgsm/functions/compress_unreal2_maps.sh @@ -4,8 +4,9 @@ # Website: https://linuxgsm.com # Description: Compresses unreal maps. -local commandaction="Unreal Map Compressor" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="MAP-COMPRESSOR" +commandaction="Compressing maps" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh fn_print_header diff --git a/lgsm/functions/compress_ut99_maps.sh b/lgsm/functions/compress_ut99_maps.sh index 94b3119ab..677f5aaa2 100644 --- a/lgsm/functions/compress_ut99_maps.sh +++ b/lgsm/functions/compress_ut99_maps.sh @@ -4,8 +4,9 @@ # Website: https://linuxgsm.com # Description: Compresses unreal maps. -local commandaction="Unreal Map Compressor" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +commandname="MAP-COMPRESSOR" +commandaction="Compressing maps" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" check.sh fn_print_header diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index ff428a909..5294b8a9d 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -17,9 +17,7 @@ # fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" # fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd" -local modulename="DOWNLOAD" -local commandaction="Download" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Emptys contents of the LinuxGSM tmpdir. fn_clear_tmp(){ @@ -42,7 +40,7 @@ fn_dl_md5(){ if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then echo -en "verifying ${local_filename} with MD5..." fn_sleep_time - local md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}') + md5sumcmd=$(md5sum "${local_filedir}/${local_filename}"|awk '{print $1;}') if [ "${md5sumcmd}" != "${md5}" ]; then fn_print_fail_eol_nl echo -e "${local_filename} returned MD5 checksum: ${md5sumcmd}" diff --git a/lgsm/functions/core_exit.sh b/lgsm/functions/core_exit.sh index 5d242816c..e2b439abd 100644 --- a/lgsm/functions/core_exit.sh +++ b/lgsm/functions/core_exit.sh @@ -4,10 +4,12 @@ # Website: https://linuxgsm.com # Description: Handles exiting of LinuxGSM by running and reporting an exit code. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + fn_exit_dev_debug(){ if [ -f "${rootdir}/.dev-debug" ]; then echo -e "" - echo -e "${function_selfname} exiting with code: ${exitcode}" + echo -e "${functionselfname} 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" fi @@ -26,13 +28,13 @@ elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then # List LinuxGSM version in logs fn_script_log_info "LinuxGSM version: ${version}" if [ "${exitcode}" == "1" ]; then - fn_script_log_fatal "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_fatal "${functionselfname} exiting with code: ${exitcode}" elif [ "${exitcode}" == "2" ]; then - fn_script_log_error "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_error "${functionselfname} exiting with code: ${exitcode}" elif [ "${exitcode}" == "3" ]; then - fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_warn "${functionselfname} exiting with code: ${exitcode}" else - fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_warn "${functionselfname} exiting with code: ${exitcode}" fi fn_exit_dev_debug # remove trap. @@ -41,7 +43,7 @@ elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then elif [ "${exitcode}" ]&&[ "${exitcode}" == "0" ]; then # List LinuxGSM version in logs fn_script_log_info "LinuxGSM version: ${version}" - fn_script_log_pass "${function_selfname} exiting with code: ${exitcode}" + fn_script_log_pass "${functionselfname} exiting with code: ${exitcode}" fn_exit_dev_debug # remove trap. trap - INT @@ -50,7 +52,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 "${function_selfname} exiting with code: NOT SET" + fn_script_log_pass "${functionselfname} 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 29bc46f56..9a7f30e98 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -5,6 +5,8 @@ # 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]}")")" + # Core core_dl.sh(){ @@ -541,7 +543,7 @@ fn_fetch_function } # Logs -logs.sh(){ +core_logs.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function } diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index 2eccb56cb..1ddc15ce2 100644 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -4,7 +4,7 @@ # Website: https://linuxgsm.com # Description: getopt arguments. -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Define all commands here. ## User commands | Trigger commands | Description diff --git a/lgsm/functions/core_legacy.sh b/lgsm/functions/core_legacy.sh index e0ea7f9b3..520287ec8 100644 --- a/lgsm/functions/core_legacy.sh +++ b/lgsm/functions/core_legacy.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Code for backwards compatability with older versions of LinuxGSM. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + if [ -z "${serverfiles}" ]; then legacymode=1 serverfiles="${filesdir}" diff --git a/lgsm/functions/logs.sh b/lgsm/functions/core_logs.sh similarity index 95% rename from lgsm/functions/logs.sh rename to lgsm/functions/core_logs.sh index 001391778..00c4d0662 100644 --- a/lgsm/functions/logs.sh +++ b/lgsm/functions/core_logs.sh @@ -1,12 +1,11 @@ #!/bin/bash -# LinuxGSM logs.sh function +# LinuxGSM core_logs.sh function # Author: Daniel Gibbs # Contributor: UltimateByte # Website: https://linuxgsm.com # Description: Acts as a log rotator, removing old logs. -local modulename="LOGS" -local commandaction="Log-Manager" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Check if logfile variable and file exist, create logfile if it doesn't exist. if [ "${consolelog}" ]; then @@ -17,7 +16,7 @@ fi # For games not displaying a console, and having logs into their game directory. check_status.sh -if [ "${status}" != "0" ]&&[ "${function_selfname}" == "command_start.sh" ]&&[ -n "${gamelogfile}" ]; then +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}" diff --git a/lgsm/functions/core_messages.sh b/lgsm/functions/core_messages.sh index 59814f62f..fd7a4b2e4 100644 --- a/lgsm/functions/core_messages.sh +++ b/lgsm/functions/core_messages.sh @@ -5,6 +5,8 @@ # Website: https://linuxgsm.com # Description: Defines on-screen messages such as [ OK ] and how script logs look. +functionselfname="$(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(){ @@ -46,8 +48,8 @@ fn_sleep_time(){ ## Feb 28 14:56:58 ut99-server: Monitor: fn_script_log(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then - echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: ${1}" >> "${lgsmlog}" + 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 @@ -58,8 +60,8 @@ fn_script_log(){ fn_script_log_pass(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then - echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: PASS: ${1}" >> "${lgsmlog}" + 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 @@ -70,8 +72,8 @@ fn_script_log_pass(){ ## Feb 28 14:56:58 ut99-server: Monitor: FATAL: fn_script_log_fatal(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then - echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: FATAL: ${1}" >> "${lgsmlog}" + 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 @@ -82,8 +84,8 @@ fn_script_log_fatal(){ ## Feb 28 14:56:58 ut99-server: Monitor: ERROR: fn_script_log_error(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then - echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: ERROR: ${1}" >> "${lgsmlog}" + 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 @@ -94,8 +96,8 @@ fn_script_log_error(){ ## Feb 28 14:56:58 ut99-server: Monitor: WARN: fn_script_log_warn(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then - echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: WARN: ${1}" >> "${lgsmlog}" + 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 @@ -106,8 +108,8 @@ fn_script_log_warn(){ ## Feb 28 14:56:58 ut99-server: Monitor: INFO: fn_script_log_info(){ if [ -d "${lgsmlogdir}" ]; then - if [ "${modulename}" ]; then - echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${modulename}: INFO: ${1}" >> "${lgsmlog}" + 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 diff --git a/lgsm/functions/core_trap.sh b/lgsm/functions/core_trap.sh index 4c9db3579..f943c5c33 100644 --- a/lgsm/functions/core_trap.sh +++ b/lgsm/functions/core_trap.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Handles CTRL-C trap to give an exit code. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + fn_exit_trap(){ echo -e "" core_exit.sh diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh index b5c278847..74523ee5c 100644 --- a/lgsm/functions/fix.sh +++ b/lgsm/functions/fix.sh @@ -5,8 +5,7 @@ # Description: Overall function for managing fixes. # Runs functions that will fix an issue. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Messages that are displayed for some fixes. fn_fix_msg_start(){ @@ -32,7 +31,7 @@ fn_fix_msg_end(){ } # Fixes that are run on start. -if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; then +if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then if [ "${appid}" ]; then fix_steamcmd.sh fi @@ -89,7 +88,7 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th fi # Fixes that are run on install only. -if [ "${function_selfname}" == "command_install.sh" ]; then +if [ "${commandname}" == "INSTALL" ]; then if [ "${shortname}" == "av" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then echo -e "" echo -e "Applying Post-Install Fixes" diff --git a/lgsm/functions/fix_ark.sh b/lgsm/functions/fix_ark.sh index 67e20d495..3c1355b1e 100644 --- a/lgsm/functions/fix_ark.sh +++ b/lgsm/functions/fix_ark.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with ARK: Survival Evolved. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + # removes mulitple appworkshop_346110.acf if found. steamappsfilewc=$(find ${HOME} -name appworkshop_346110.acf | wc -l) if [ "${steamappsfilewc}" -gt "1" ]; then diff --git a/lgsm/functions/fix_arma3.sh b/lgsm/functions/fix_arma3.sh index 60dd4db25..f71fcde7b 100644 --- a/lgsm/functions/fix_arma3.sh +++ b/lgsm/functions/fix_arma3.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves an issue with ARMA3. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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_av.sh b/lgsm/functions/fix_av.sh index fcbab6b13..bf9ff2b4b 100644 --- a/lgsm/functions/fix_av.sh +++ b/lgsm/functions/fix_av.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves startup issue with Avorion -local commandname="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" diff --git a/lgsm/functions/fix_csgo.sh b/lgsm/functions/fix_csgo.sh index f1f9c9241..6b213d388 100644 --- a/lgsm/functions/fix_csgo.sh +++ b/lgsm/functions/fix_csgo.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with CS:GO. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/fix_dst.sh index ca86bdd4f..b203e1cd8 100644 --- a/lgsm/functions/fix_dst.sh +++ b/lgsm/functions/fix_dst.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Don't Starve Together. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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_ges.sh b/lgsm/functions/fix_ges.sh index bbd08c645..6065f9ba8 100644 --- a/lgsm/functions/fix_ges.sh +++ b/lgsm/functions/fix_ges.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with GoldenEye: Source. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: MALLOC_CHECK_ needing to be set to 0. export MALLOC_CHECK_=0 diff --git a/lgsm/functions/fix_hw.sh b/lgsm/functions/fix_hw.sh index 8b5844f52..954a834a0 100644 --- a/lgsm/functions/fix_hw.sh +++ b/lgsm/functions/fix_hw.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Hurtworld. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + if [ "${shortname}" == "hw" ]; then # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so. if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then diff --git a/lgsm/functions/fix_ins.sh b/lgsm/functions/fix_ins.sh index 8bd3f310b..f41dffbd4 100644 --- a/lgsm/functions/fix_ins.sh +++ b/lgsm/functions/fix_ins.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Insurgency. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(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. @@ -13,7 +12,7 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/bin" # Fixes: issue #529 - gamemode not passed to debug or start. -if [ "${function_selfname}" == "command_debug.sh" ]; then +if [ "${commandname}" == "DEBUG" ]; then defaultmap="\"${defaultmap}\"" else defaultmap="\\\"${defaultmap}\\\"" diff --git a/lgsm/functions/fix_kf.sh b/lgsm/functions/fix_kf.sh index f1b6d7b89..f0c29ee6f 100644 --- a/lgsm/functions/fix_kf.sh +++ b/lgsm/functions/fix_kf.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Killing Floor. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/fix_kf2.sh index 2e54f1133..77edd77e8 100644 --- a/lgsm/functions/fix_kf2.sh +++ b/lgsm/functions/fix_kf2.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Killing Floor 2. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_parms(){ parms="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\"" diff --git a/lgsm/functions/fix_mcb.sh b/lgsm/functions/fix_mcb.sh index c417a8a39..691647fb7 100644 --- a/lgsm/functions/fix_mcb.sh +++ b/lgsm/functions/fix_mcb.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves possible startup issue with Minecraft Bedrock. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(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/functions/fix_mta.sh index 662a1df00..d57e04f3a 100644 --- a/lgsm/functions/fix_mta.sh +++ b/lgsm/functions/fix_mta.sh @@ -5,9 +5,7 @@ # Website: https://linuxgsm.com # Description: Installs the libmysqlclient for database functions on the server. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/fix_nmrih.sh index 62ba20c21..2c9d8c743 100644 --- a/lgsm/functions/fix_nmrih.sh +++ b/lgsm/functions/fix_nmrih.sh @@ -4,8 +4,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/ -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(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/functions/fix_onset.sh index 59f7783ed..630245844 100644 --- a/lgsm/functions/fix_onset.sh +++ b/lgsm/functions/fix_onset.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Onset. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_ro.sh b/lgsm/functions/fix_ro.sh index f07581ae2..9f08d56d7 100644 --- a/lgsm/functions/fix_ro.sh +++ b/lgsm/functions/fix_ro.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Red Orchestra. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/fix_rust.sh index 29f2299c6..9ceff7b29 100644 --- a/lgsm/functions/fix_rust.sh +++ b/lgsm/functions/fix_rust.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves startup issue with Rust. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: [Raknet] Server Shutting Down (Shutting Down). export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${systemdir}/RustDedicated_Data/Plugins/x86_64" diff --git a/lgsm/functions/fix_rw.sh b/lgsm/functions/fix_rw.sh index 650d3b231..b02ec343e 100644 --- a/lgsm/functions/fix_rw.sh +++ b/lgsm/functions/fix_rw.sh @@ -4,7 +4,6 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Rising World. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" diff --git a/lgsm/functions/fix_sdtd.sh b/lgsm/functions/fix_sdtd.sh index acb1d9891..91c94897a 100644 --- a/lgsm/functions/fix_sdtd.sh +++ b/lgsm/functions/fix_sdtd.sh @@ -4,7 +4,6 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with 7 Days to Die. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}" diff --git a/lgsm/functions/fix_sfc.sh b/lgsm/functions/fix_sfc.sh index f74984753..874d6eca7 100644 --- a/lgsm/functions/fix_sfc.sh +++ b/lgsm/functions/fix_sfc.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Source Forts Classic. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/fix_sof2.sh index cdffa6c7f..51224c8e0 100644 --- a/lgsm/functions/fix_sof2.sh +++ b/lgsm/functions/fix_sof2.sh @@ -4,8 +4,6 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Soldier of Fortune 2. -local modulename="FIX" -local commandaction="Fix" - +functionselfname="$(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_ss3.sh b/lgsm/functions/fix_ss3.sh index 1a5b22d7f..6bea53861 100644 --- a/lgsm/functions/fix_ss3.sh +++ b/lgsm/functions/fix_ss3.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Serious Sam 3. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: https://steamcommunity.com/app/41070/discussions/0/353916981477716386/ if [ ! -f "${serverfiles}/Bin/steamclient.so" ]||[ "$(diff "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so" 2>/dev/null)" ]; then diff --git a/lgsm/functions/fix_steamcmd.sh b/lgsm/functions/fix_steamcmd.sh index aba06461c..be5197b9d 100644 --- a/lgsm/functions/fix_steamcmd.sh +++ b/lgsm/functions/fix_steamcmd.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues related to SteamCMD. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so. if [ ! -f "${HOME}/.steam/sdk64/steamclient.so" ]; then diff --git a/lgsm/functions/fix_terraria.sh b/lgsm/functions/fix_terraria.sh index bce7d44f8..712416bd8 100644 --- a/lgsm/functions/fix_terraria.sh +++ b/lgsm/functions/fix_terraria.sh @@ -4,8 +4,6 @@ # Website: https://linuxgsm.com # Description: Resolves an issue with Terraria. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export TERM=xterm diff --git a/lgsm/functions/fix_tf2.sh b/lgsm/functions/fix_tf2.sh index 72c5b53ab..59b841226 100644 --- a/lgsm/functions/fix_tf2.sh +++ b/lgsm/functions/fix_tf2.sh @@ -4,9 +4,7 @@ # Website: https://github.com/vectorsigma # Description: Resolves various issues with Team Fortress 2. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/fix_ts3.sh index 5b4c010c7..b019012f7 100644 --- a/lgsm/functions/fix_ts3.sh +++ b/lgsm/functions/fix_ts3.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Teamspeak 3. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: makes libmariadb2 available #1924. if [ ! -f "${serverfiles}/libmariadb.so.2" ]; then diff --git a/lgsm/functions/fix_tu.sh b/lgsm/functions/fix_tu.sh index 24bae047a..1f01fd7b3 100644 --- a/lgsm/functions/fix_tu.sh +++ b/lgsm/functions/fix_tu.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Tower Unite. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + if [ "${shortname}" == "tu" ]; then # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so. if [ ! -f "${executabledir}/steamclient.so" ]; then diff --git a/lgsm/functions/fix_unt.sh b/lgsm/functions/fix_unt.sh index f55be43a9..60f3d2edf 100644 --- a/lgsm/functions/fix_unt.sh +++ b/lgsm/functions/fix_unt.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves startup issue with Unturned. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # steamclient.so: cannot open shared object file: No such file or directory export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" diff --git a/lgsm/functions/fix_ut.sh b/lgsm/functions/fix_ut.sh index e3e004be4..f9c81348a 100644 --- a/lgsm/functions/fix_ut.sh +++ b/lgsm/functions/fix_ut.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Unreal Tournament. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/fix_ut2k4.sh index 8dfb33432..fa2d29bf5 100644 --- a/lgsm/functions/fix_ut2k4.sh +++ b/lgsm/functions/fix_ut2k4.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Unreal Tournament 2004. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/fix_ut3.sh index 4c099294f..e6c018d00 100644 --- a/lgsm/functions/fix_ut3.sh +++ b/lgsm/functions/fix_ut3.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Unreal Tournament 3. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_parms(){ parms="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_wurm.sh b/lgsm/functions/fix_wurm.sh index 79babb65e..809651d55 100644 --- a/lgsm/functions/fix_wurm.sh +++ b/lgsm/functions/fix_wurm.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Wurm Unlimited. -local modulename="FIX" -local commandaction="Fix" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Copies steamclient.so to correct location. if [ ! -f "${serverfiles}/nativelibs" ]; then diff --git a/lgsm/functions/fix_zmr.sh b/lgsm/functions/fix_zmr.sh index dade0ee1d..1825fa327 100644 --- a/lgsm/functions/fix_zmr.sh +++ b/lgsm/functions/fix_zmr.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with Zombie Master: Reborn. -local modulename="FIX" -local commandaction="Fix" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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_config.sh b/lgsm/functions/info_config.sh index 75d248ba4..282559deb 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -5,7 +5,7 @@ # Website: https://linuxgsm.com # Description: Gets specific details from config files. -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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_distro.sh b/lgsm/functions/info_distro.sh index de35150ac..0316e25a3 100644 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -5,7 +5,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. -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Game Server pid if [ "${status}" == "1" ]; then diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index 07bbaa7f7..6d46d1b22 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Defines server info messages for details and alerts. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + # Standard Details # This applies to all engines @@ -1507,7 +1509,7 @@ fn_info_message_select_engine(){ # Separator is different for details fn_messages_separator(){ - if [ "${function_selfname}" == "command_details.sh" ]; then + if [ "${commandname}" == "details" ]; then printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = else echo -e "=================================" @@ -1516,7 +1518,7 @@ fn_messages_separator(){ # Removes the passwords form all but details fn_info_message_password_strip(){ - if [ "${function_selfname}" != "command_details.sh" ]; then + if [ "${commandname}" != "DETAILS" ]; then if [ "${serverpassword}" ]; then serverpassword="********" fi diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh index 870cffd2a..1a6a42bb8 100644 --- a/lgsm/functions/info_parms.sh +++ b/lgsm/functions/info_parms.sh @@ -4,7 +4,7 @@ # Website: https://linuxgsm.com # Description: If specific parms are not set then this will be displayed in details. -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/install_complete.sh b/lgsm/functions/install_complete.sh index 03beeddd5..62eec08a2 100644 --- a/lgsm/functions/install_complete.sh +++ b/lgsm/functions/install_complete.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Prints installation completion message and hints. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "=================================" diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index 0322be9fb..13558e4da 100644 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Creates default server configs. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/install_dst_token.sh index b1fec01c3..7eab2a153 100644 --- a/lgsm/functions/install_dst_token.sh +++ b/lgsm/functions/install_dst_token.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Configures Don't Starve Together cluster with given token. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/install_eula.sh index d7893b16c..cd51954d0 100644 --- a/lgsm/functions/install_eula.sh +++ b/lgsm/functions/install_eula.sh @@ -4,6 +4,8 @@ # Website: https://linuxgsm.com # Description: Gets user to accept the EULA. +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + if [ "${shortname}" == "ts3" ]; then eulaurl="https://www.teamspeak.com/en/privacy-and-terms" elif [ "${shortname}" == "mc" ]; then @@ -25,7 +27,7 @@ if [ -z "${autoinstall}" ]; then if ! fn_prompt_yn "Continue?" Y; then core_exit.sh fi -elif [ "${function_selfname}" == "command_start.sh" ]; then +elif [ "${commandname}" == "START" ]; then fn_print_info "By continuing you are indicating your agreement to the EULA." echo -e "" sleep 5 diff --git a/lgsm/functions/install_factorio_save.sh b/lgsm/functions/install_factorio_save.sh index 5abdc4069..71690a7a7 100644 --- a/lgsm/functions/install_factorio_save.sh +++ b/lgsm/functions/install_factorio_save.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Creates the initial save file for Factorio -local modulename="INSTALL" -local commandaction="Install" +functionselfname="$(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/functions/install_gslt.sh index ae10508b5..27d384936 100644 --- a/lgsm/functions/install_gslt.sh +++ b/lgsm/functions/install_gslt.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Configures GSLT. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/install_header.sh index 8a63fb289..f67860dd4 100644 --- a/lgsm/functions/install_header.sh +++ b/lgsm/functions/install_header.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Prints installation header. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" clear fn_print_ascii_logo diff --git a/lgsm/functions/install_logs.sh b/lgsm/functions/install_logs.sh index 98057df6f..be54eb42d 100644 --- a/lgsm/functions/install_logs.sh +++ b/lgsm/functions/install_logs.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Creates log directories. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${checklogs}" != "1" ]; then echo -e "" diff --git a/lgsm/functions/install_mta_resources.sh b/lgsm/functions/install_mta_resources.sh index 01ceeeb80..194d9f546 100644 --- a/lgsm/functions/install_mta_resources.sh +++ b/lgsm/functions/install_mta_resources.sh @@ -5,9 +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 -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/install_retry.sh index 3a65049ce..2d6e3df7b 100644 --- a/lgsm/functions/install_retry.sh +++ b/lgsm/functions/install_retry.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Asks for installation retry after failure. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if fn_prompt_yn "Retry install?" Y; then command_install.sh; core_exit.sh diff --git a/lgsm/functions/install_server_dir.sh b/lgsm/functions/install_server_dir.sh index 71f2aa4c4..cfd586dc4 100644 --- a/lgsm/functions/install_server_dir.sh +++ b/lgsm/functions/install_server_dir.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Creates the server directory. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/install_server_files.sh index 8cb203bac..a3ddd435a 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Installs server files. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/install_squad_license.sh index accb3021e..b17b1ab7e 100644 --- a/lgsm/functions/install_squad_license.sh +++ b/lgsm/functions/install_squad_license.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Configures the Squad server's license. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/install_stats.sh index 2d44706e8..355b7fa67 100644 --- a/lgsm/functions/install_stats.sh +++ b/lgsm/functions/install_stats.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Enabled LinuxGSM Stats. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}LinuxGSM Stats${default}" diff --git a/lgsm/functions/install_steamcmd.sh b/lgsm/functions/install_steamcmd.sh index 9a2415079..40acf435b 100644 --- a/lgsm/functions/install_steamcmd.sh +++ b/lgsm/functions/install_steamcmd.sh @@ -4,8 +4,7 @@ # Website: https://linuxgsm.com # Description: Downloads SteamCMD on install. -local modulename="INSTALL" -local commandaction="Install" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${lightyellow}Installing SteamCMD${default}" diff --git a/lgsm/functions/install_ts3db.sh b/lgsm/functions/install_ts3db.sh index 7cc448d7b..a77a0ea38 100644 --- a/lgsm/functions/install_ts3db.sh +++ b/lgsm/functions/install_ts3db.sh @@ -5,9 +5,7 @@ # Website: https://linuxgsm.com # Description: Installs the database server MariaDB for TeamSpeak 3. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/install_ut2k4_key.sh index cb02829d2..144ac278e 100644 --- a/lgsm/functions/install_ut2k4_key.sh +++ b/lgsm/functions/install_ut2k4_key.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Activates ut2k4 server with given key. -local modulename="INSTALL" -local commandaction="Install" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/mods_core.sh index ff088653b..7fc030210 100644 --- a/lgsm/functions/mods_core.sh +++ b/lgsm/functions/mods_core.sh @@ -5,9 +5,7 @@ # Website: https://linuxgsm.com # Description: Core functions for mods list/install/update/remove -local modulename="MODS" -local commandaction="Mods" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Files and Directories. modsdir="${lgsmdir}/mods" diff --git a/lgsm/functions/mods_list.sh b/lgsm/functions/mods_list.sh index ed354d153..e47f3f909 100644 --- a/lgsm/functions/mods_list.sh +++ b/lgsm/functions/mods_list.sh @@ -8,9 +8,7 @@ # Usage: Then add this array to the mods_global_array. # Usage: If needed, you can scrape the download URL first. -local modulename="MODS" -local commandaction="List Mods" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(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/functions/query_gamedig.sh index bfe38b937..fca71c57c 100644 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/functions/query_gamedig.sh @@ -5,6 +5,8 @@ # Description: Querys a gameserver using node-gamedig. # https://github.com/sonicsnes/node-gamedig +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + # 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/update_factorio.sh b/lgsm/functions/update_factorio.sh index 1fcfe9bf9..e45a75c8c 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Factorio servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_factorio_dl(){ fn_fetch_file "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index a8f97dd17..d74586143 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Minecraft servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_minecraft_dl(){ if [ "${branch}" == "release" ]; then diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/functions/update_minecraft_bedrock.sh index d9d875c45..3336d13ff 100644 --- a/lgsm/functions/update_minecraft_bedrock.sh +++ b/lgsm/functions/update_minecraft_bedrock.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Minecraft Bedrock servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_minecraft_dl(){ latestmcbuildurl=$(curl -s "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*zip') diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh index db3080b17..57c452d8a 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/functions/update_mta.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Multi Theft Auto servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_mta_dl(){ fn_fetch_file "http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz" "${tmpdir}" "multitheftauto_linux_x64.tar.gz" diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh index 88a7102c8..38fc78aa3 100644 --- a/lgsm/functions/update_mumble.sh +++ b/lgsm/functions/update_mumble.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Mumble servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_mumble_dl(){ fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${remotebuild}/murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "${tmpdir}" "murmur-static_${mumblearch}-${remotebuild}.tar.bz2" diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index ed809451a..1ab93ad53 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating using SteamCMD. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_steamcmd_dl(){ info_config.sh @@ -224,7 +222,7 @@ fn_stop_warning(){ # The location where the builds are checked and downloaded. remotelocation="SteamCMD" -check.sh +check_steamcmd.sh if [ "${forceupdate}" == "1" ]; then # forceupdate bypasses update checks. diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index 593183f6f..e50590087 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -4,9 +4,7 @@ # Website: https://linuxgsm.com # Description: Handles updating of Teamspeak 3 servers. -local modulename="UPDATE" -local commandaction="Update" -local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_ts3_dl(){ if [ "${ts3arch}" == "amd64" ]; then diff --git a/linuxgsm.sh b/linuxgsm.sh index 19ebb01af..ca9d38852 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -23,6 +23,7 @@ fi version="v20.2.0" shortname="core" gameservername="core" +commandname="CORE" rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") lgsmdir="${rootdir}/lgsm"