From 9b1b8c3e09bb6af01fdb5d6c11c7e857dede77ff Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 10 Oct 2023 23:14:21 +0100 Subject: [PATCH] refactor: remove unnecessary print statements This commit refactors the code by removing unnecessary print statements in multiple files. The removed print statements were used for displaying dots and warnings, but they are not needed anymore. This improves the readability and cleanliness of the code. --- lgsm/modules/check_config.sh | 3 --- lgsm/modules/command_backup.sh | 5 ++++- lgsm/modules/command_dev_debug.sh | 4 ++++ lgsm/modules/command_monitor.sh | 1 + lgsm/modules/command_start.sh | 1 + lgsm/modules/command_stop.sh | 1 + lgsm/modules/command_update_linuxgsm.sh | 2 +- lgsm/modules/command_validate.sh | 6 +++--- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lgsm/modules/check_config.sh b/lgsm/modules/check_config.sh index 436740afa..42892a191 100644 --- a/lgsm/modules/check_config.sh +++ b/lgsm/modules/check_config.sh @@ -8,7 +8,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then - fn_print_dots "" fn_print_warn_nl "Configuration file missing!" echo -e "${servercfgfullpath}" fn_script_log_warn "Configuration file missing!" @@ -17,11 +16,9 @@ if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then fi if [ "${shortname}" == "rust" ] && [ -v rconpassword ] && [ -z "${rconpassword}" ]; then - fn_print_dots "" fn_print_fail_nl "RCON password is not set" fn_script_log_warn "RCON password is not set" elif [ -v rconpassword ] && [ "${rconpassword}" == "CHANGE_ME" ]; then - fn_print_dots "" fn_print_warn_nl "Default RCON Password detected" fn_script_log_warn "Default RCON Password detected" fi diff --git a/lgsm/modules/command_backup.sh b/lgsm/modules/command_backup.sh index fc0fc2d5b..0f5f3332d 100644 --- a/lgsm/modules/command_backup.sh +++ b/lgsm/modules/command_backup.sh @@ -264,7 +264,10 @@ fn_backup_start_server() { fi } -# Run functions. +fn_print_dots "" +check.sh +core_logs.sh + fn_backup_check_lockfile fn_backup_init fn_backup_stop_server diff --git a/lgsm/modules/command_dev_debug.sh b/lgsm/modules/command_dev_debug.sh index 081bda611..eb0356985 100644 --- a/lgsm/modules/command_dev_debug.sh +++ b/lgsm/modules/command_dev_debug.sh @@ -10,6 +10,10 @@ commandaction="Developer debug" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_reset +fn_print_dots "" +check.sh +core_logs.sh + if [ -f "${rootdir}/.dev-debug" ]; then rm -f "${rootdir:?}/.dev-debug" fn_print_ok_nl "Disabled dev-debug" diff --git a/lgsm/modules/command_monitor.sh b/lgsm/modules/command_monitor.sh index f8ceb849f..d4d88bd56 100644 --- a/lgsm/modules/command_monitor.sh +++ b/lgsm/modules/command_monitor.sh @@ -371,6 +371,7 @@ fn_monitor_loop() { done } +fn_print_dots "" monitorflag=1 # Dont do any monitoring or checks if installer is running. fn_monitor_check_install diff --git a/lgsm/modules/command_start.sh b/lgsm/modules/command_start.sh index 971b3a8c6..364733ea2 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -186,6 +186,7 @@ if [ "${firstcommandname}" == "START" ] || [ "${firstcommandname}" == "RESTART" date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock" fi +fn_print_dots "" check.sh # If the server already started dont start again. diff --git a/lgsm/modules/command_stop.sh b/lgsm/modules/command_stop.sh index 430f8a030..1567252f9 100644 --- a/lgsm/modules/command_stop.sh +++ b/lgsm/modules/command_stop.sh @@ -268,6 +268,7 @@ fn_stop_pre_check() { fi } +fn_print_dots "" check.sh # Create a stopping lockfile that only exists while the stop command is running. diff --git a/lgsm/modules/command_update_linuxgsm.sh b/lgsm/modules/command_update_linuxgsm.sh index a4ad88ac0..9cd66430c 100644 --- a/lgsm/modules/command_update_linuxgsm.sh +++ b/lgsm/modules/command_update_linuxgsm.sh @@ -10,10 +10,10 @@ commandaction="Updating LinuxGSM" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set +fn_print_dots "" check.sh info_distro.sh -fn_print_dots "" fn_script_log_info "Updating LinuxGSM" fn_print_dots "Selecting repo" diff --git a/lgsm/modules/command_validate.sh b/lgsm/modules/command_validate.sh index a512fa962..d3511d7bb 100644 --- a/lgsm/modules/command_validate.sh +++ b/lgsm/modules/command_validate.sh @@ -27,11 +27,11 @@ fn_validate() { fn_dl_steamcmd } -# The location where the builds are checked and downloaded. -remotelocation="SteamCMD" +fn_print_dots "" check.sh +core_logs.sh -fn_print_dots "${remotelocation}" +fn_print_dots "SteamCMD" if [ "${status}" != "0" ]; then fn_print_restart_warning