Browse Source

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.
pull/4339/head
Daniel Gibbs 2 years ago
parent
commit
9b1b8c3e09
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 3
      lgsm/modules/check_config.sh
  2. 5
      lgsm/modules/command_backup.sh
  3. 4
      lgsm/modules/command_dev_debug.sh
  4. 1
      lgsm/modules/command_monitor.sh
  5. 1
      lgsm/modules/command_start.sh
  6. 1
      lgsm/modules/command_stop.sh
  7. 2
      lgsm/modules/command_update_linuxgsm.sh
  8. 6
      lgsm/modules/command_validate.sh

3
lgsm/modules/check_config.sh

@ -8,7 +8,6 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then
fn_print_dots ""
fn_print_warn_nl "Configuration file missing!" fn_print_warn_nl "Configuration file missing!"
echo -e "${servercfgfullpath}" echo -e "${servercfgfullpath}"
fn_script_log_warn "Configuration file missing!" fn_script_log_warn "Configuration file missing!"
@ -17,11 +16,9 @@ if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then
fi fi
if [ "${shortname}" == "rust" ] && [ -v rconpassword ] && [ -z "${rconpassword}" ]; then if [ "${shortname}" == "rust" ] && [ -v rconpassword ] && [ -z "${rconpassword}" ]; then
fn_print_dots ""
fn_print_fail_nl "RCON password is not set" fn_print_fail_nl "RCON password is not set"
fn_script_log_warn "RCON password is not set" fn_script_log_warn "RCON password is not set"
elif [ -v rconpassword ] && [ "${rconpassword}" == "CHANGE_ME" ]; then elif [ -v rconpassword ] && [ "${rconpassword}" == "CHANGE_ME" ]; then
fn_print_dots ""
fn_print_warn_nl "Default RCON Password detected" fn_print_warn_nl "Default RCON Password detected"
fn_script_log_warn "Default RCON Password detected" fn_script_log_warn "Default RCON Password detected"
fi fi

5
lgsm/modules/command_backup.sh

@ -264,7 +264,10 @@ fn_backup_start_server() {
fi fi
} }
# Run functions. fn_print_dots ""
check.sh
core_logs.sh
fn_backup_check_lockfile fn_backup_check_lockfile
fn_backup_init fn_backup_init
fn_backup_stop_server fn_backup_stop_server

4
lgsm/modules/command_dev_debug.sh

@ -10,6 +10,10 @@ commandaction="Developer debug"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_reset fn_firstcommand_reset
fn_print_dots ""
check.sh
core_logs.sh
if [ -f "${rootdir}/.dev-debug" ]; then if [ -f "${rootdir}/.dev-debug" ]; then
rm -f "${rootdir:?}/.dev-debug" rm -f "${rootdir:?}/.dev-debug"
fn_print_ok_nl "Disabled dev-debug" fn_print_ok_nl "Disabled dev-debug"

1
lgsm/modules/command_monitor.sh

@ -371,6 +371,7 @@ fn_monitor_loop() {
done done
} }
fn_print_dots ""
monitorflag=1 monitorflag=1
# Dont do any monitoring or checks if installer is running. # Dont do any monitoring or checks if installer is running.
fn_monitor_check_install fn_monitor_check_install

1
lgsm/modules/command_start.sh

@ -186,6 +186,7 @@ if [ "${firstcommandname}" == "START" ] || [ "${firstcommandname}" == "RESTART"
date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock" date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock"
fi fi
fn_print_dots ""
check.sh check.sh
# If the server already started dont start again. # If the server already started dont start again.

1
lgsm/modules/command_stop.sh

@ -268,6 +268,7 @@ fn_stop_pre_check() {
fi fi
} }
fn_print_dots ""
check.sh check.sh
# Create a stopping lockfile that only exists while the stop command is running. # Create a stopping lockfile that only exists while the stop command is running.

2
lgsm/modules/command_update_linuxgsm.sh

@ -10,10 +10,10 @@ commandaction="Updating LinuxGSM"
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set fn_firstcommand_set
fn_print_dots ""
check.sh check.sh
info_distro.sh info_distro.sh
fn_print_dots ""
fn_script_log_info "Updating LinuxGSM" fn_script_log_info "Updating LinuxGSM"
fn_print_dots "Selecting repo" fn_print_dots "Selecting repo"

6
lgsm/modules/command_validate.sh

@ -27,11 +27,11 @@ fn_validate() {
fn_dl_steamcmd fn_dl_steamcmd
} }
# The location where the builds are checked and downloaded. fn_print_dots ""
remotelocation="SteamCMD"
check.sh check.sh
core_logs.sh
fn_print_dots "${remotelocation}" fn_print_dots "SteamCMD"
if [ "${status}" != "0" ]; then if [ "${status}" != "0" ]; then
fn_print_restart_warning fn_print_restart_warning

Loading…
Cancel
Save