From 42d14f5de38c3deae25494651562ea8fc1445bcc Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 2 Oct 2023 16:56:10 +0100 Subject: [PATCH] refactor: remove unnecessary fn_sleep_time calls This commit removes the fn_sleep_time function calls that are no longer needed in multiple modules. The fn_sleep_time function was used to introduce a delay, but it is no longer necessary for the current implementation. --- lgsm/modules/alert_email.sh | 1 - lgsm/modules/check_deps.sh | 2 -- lgsm/modules/check_permissions.sh | 2 +- lgsm/modules/core_dl.sh | 1 - lgsm/modules/core_logs.sh | 1 - lgsm/modules/core_messages.sh | 1 + lgsm/modules/fix.sh | 1 - lgsm/modules/fix_av.sh | 1 - lgsm/modules/fix_kf2.sh | 1 - lgsm/modules/fix_lo.sh | 2 -- lgsm/modules/fix_mta.sh | 1 - lgsm/modules/fix_ut3.sh | 1 - lgsm/modules/install_dst_token.sh | 1 - lgsm/modules/install_eula.sh | 1 - lgsm/modules/install_factorio_save.sh | 1 - lgsm/modules/install_header.sh | 2 -- lgsm/modules/install_server_files.sh | 1 - lgsm/modules/install_squad_license.sh | 1 - lgsm/modules/install_steamcmd.sh | 1 - lgsm/modules/install_ts3db.sh | 3 --- lgsm/modules/install_ut2k4_key.sh | 1 - 21 files changed, 2 insertions(+), 25 deletions(-) diff --git a/lgsm/modules/alert_email.sh b/lgsm/modules/alert_email.sh index f8533713ad..0aca09fef1 100644 --- a/lgsm/modules/alert_email.sh +++ b/lgsm/modules/alert_email.sh @@ -8,7 +8,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_print_dots "Sending Email alert: ${email}" -fn_sleep_time if [ -n "${emailfrom}" ]; then mail -s "${alertsubject}" -r "${emailfrom}" "${email}" < "${alertlog}" diff --git a/lgsm/modules/check_deps.sh b/lgsm/modules/check_deps.sh index 65baede3b6..d10948ca53 100644 --- a/lgsm/modules/check_deps.sh +++ b/lgsm/modules/check_deps.sh @@ -138,7 +138,6 @@ fn_install_missing_deps() { fn_print_warn "Missing dependencies: ${red}${array_deps_missing[*]}${default}" fn_script_log_warn "Missing dependencies: ${array_deps_missing[*]}" fi - fn_sleep_time # Attempt automatic dependency installation if [ "${autoinstall}" == "1" ]; then @@ -340,7 +339,6 @@ if [ "${commandname}" == "INSTALL" ]; then fn_messages_separator fn_print_information_nl "Checking any missing dependencies for ${gamename} server only." fn_print_information_nl "This will NOT install a ${gamename} server." - fn_sleep_time else echo -e "" echo -e "${bold}${lightyellow}Checking ${gamename} Dependencies${default}" diff --git a/lgsm/modules/check_permissions.sh b/lgsm/modules/check_permissions.sh index 172d32c88e..a6a37ce5c6 100644 --- a/lgsm/modules/check_permissions.sh +++ b/lgsm/modules/check_permissions.sh @@ -198,7 +198,7 @@ fn_sys_perm_errors_fix() { if [ "${sysdirpermerror}" == "1" ] || [ "${classdirpermerror}" == "1" ] || [ "${netdirpermerror}" == "1" ]; then fn_print_error "Could not fix /sys permissions" fn_script_log_error "Could not fix /sys permissions." - fn_sleep_time + # Show the user how to fix. fn_sys_perm_fix_manually_msg else diff --git a/lgsm/modules/core_dl.sh b/lgsm/modules/core_dl.sh index 2f43ad729f..3b2e7f117c 100644 --- a/lgsm/modules/core_dl.sh +++ b/lgsm/modules/core_dl.sh @@ -277,7 +277,6 @@ fn_fetch_trap() { echo -en "downloading ${local_filename}..." fn_print_canceled_eol_nl fn_script_log_info "Downloading ${local_filename}...CANCELED" - fn_sleep_time rm -f "${local_filedir:?}/${local_filename}" echo -en "downloading ${local_filename}..." fn_print_removed_eol_nl diff --git a/lgsm/modules/core_logs.sh b/lgsm/modules/core_logs.sh index 8057f30f74..3166041aef 100644 --- a/lgsm/modules/core_logs.sh +++ b/lgsm/modules/core_logs.sh @@ -46,7 +46,6 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ]; ulxcount="0" darkrpcount="0" legacycount="0" - fn_sleep_time fn_print_info "Removing logs older than ${logdays} days" fn_script_log_info "Removing logs older than ${logdays} days" # Logging logfiles to be removed according to "${logdays}", counting and removing them. diff --git a/lgsm/modules/core_messages.sh b/lgsm/modules/core_messages.sh index bed0801e50..5af4c5639a 100644 --- a/lgsm/modules/core_messages.sh +++ b/lgsm/modules/core_messages.sh @@ -279,6 +279,7 @@ fn_messages_separator() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = else echo -e "${bold}=================================${default}" + fn_sleep_time fi } diff --git a/lgsm/modules/fix.sh b/lgsm/modules/fix.sh index 7c59d66b8c..9a4f5b779b 100644 --- a/lgsm/modules/fix.sh +++ b/lgsm/modules/fix.sh @@ -81,7 +81,6 @@ if [ "${commandname}" == "INSTALL" ]; then echo -e "" echo -e "${lightyellow}Applying Post-Install Fixes${default}" fn_messages_separator - fn_sleep_time postinstall=1 fn_apply_fix "post install" "${shortname}" fi diff --git a/lgsm/modules/fix_av.sh b/lgsm/modules/fix_av.sh index fbb2599002..bfff59af6d 100644 --- a/lgsm/modules/fix_av.sh +++ b/lgsm/modules/fix_av.sh @@ -13,7 +13,6 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" if [ ! -f "${servercfgfullpath}" ]; then startparameters="--datapath ${avdatapath} --galaxy-name ${selfname} --init-folders-only" fn_print_information "starting ${gamename} server to generate configs." - fn_sleep_time cd "${systemdir}" || exit eval "${executable} ${startparameters}" fi diff --git a/lgsm/modules/fix_kf2.sh b/lgsm/modules/fix_kf2.sh index 46850bd64e..13176d4487 100644 --- a/lgsm/modules/fix_kf2.sh +++ b/lgsm/modules/fix_kf2.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" startparameters="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\"" fn_print_information "starting ${gamename} server to generate configs." -fn_sleep_time exitbypass=1 command_start.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_lo.sh b/lgsm/modules/fix_lo.sh index 4c3758b01d..4966afd570 100644 --- a/lgsm/modules/fix_lo.sh +++ b/lgsm/modules/fix_lo.sh @@ -9,9 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" appidfile=${executabledir}/steam_appid.txt if [ ! -f "${appidfile}" ]; then fn_print_information "adding ${appidfile} to ${gamename} server." - fn_sleep_time echo "903950" > "${appidfile}" else fn_print_information "${appidfile} already exists. No action to be taken." - fn_sleep_time fi diff --git a/lgsm/modules/fix_mta.sh b/lgsm/modules/fix_mta.sh index 65488f2a16..4e533eb51d 100644 --- a/lgsm/modules/fix_mta.sh +++ b/lgsm/modules/fix_mta.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then fixname="libmysqlclient16" fn_fix_msg_start_nl - fn_sleep_time fn_fetch_file "https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16" "" "" "" "${lgsmdir}/lib" "libmysqlclient.so.16" "chmodx" "norun" "noforce" "6c188e0f8fb5d7a29f4bc413b9fed6c2" fn_fix_msg_end fi diff --git a/lgsm/modules/fix_ut3.sh b/lgsm/modules/fix_ut3.sh index 97326c7868..d725de4a2d 100644 --- a/lgsm/modules/fix_ut3.sh +++ b/lgsm/modules/fix_ut3.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" startparameters="server VCTF-Suspense?Game=UTGameContent.UTVehicleCTFGame_Content?bIsDedicated=true?bIsLanMatch=false?bUsesStats=false?bShouldAdvertise=false?PureServer=1?bAllowJoinInProgress=true?ConfigSubDir=${selfname} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}" fn_print_information "starting ${gamename} server to generate configs." -fn_sleep_time exitbypass=1 command_start.sh fn_firstcommand_reset diff --git a/lgsm/modules/install_dst_token.sh b/lgsm/modules/install_dst_token.sh index 3c647612db..89ec00a901 100644 --- a/lgsm/modules/install_dst_token.sh +++ b/lgsm/modules/install_dst_token.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${bold}${lightyellow}Enter ${gamename} Cluster Token${default}" fn_messages_separator -fn_sleep_time echo -e "A cluster token is required to run this server!" echo -e "Follow the instructions in this link to obtain this key:" echo -e "https://linuxgsm.com/dst-auth-token" diff --git a/lgsm/modules/install_eula.sh b/lgsm/modules/install_eula.sh index 87d1fe053a..7f0229bfa2 100644 --- a/lgsm/modules/install_eula.sh +++ b/lgsm/modules/install_eula.sh @@ -18,7 +18,6 @@ fi echo -e "" echo -e "${bold}${lightyellow}Accept ${gamename} EULA${default}" fn_messages_separator -fn_sleep_time echo -e "You are required to accept the EULA:" echo -e "${eulaurl}" echo -e "" diff --git a/lgsm/modules/install_factorio_save.sh b/lgsm/modules/install_factorio_save.sh index cfd793cac9..589a9d8ed8 100644 --- a/lgsm/modules/install_factorio_save.sh +++ b/lgsm/modules/install_factorio_save.sh @@ -10,6 +10,5 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${bold}${lightyellow}Creating initial Factorio savefile${default}" fn_messages_separator -fn_sleep_time check_glibc.sh "${executabledir}"/factorio --create "${serverfiles}/save1" diff --git a/lgsm/modules/install_header.sh b/lgsm/modules/install_header.sh index f0c85dba29..a7f1f9ddb1 100644 --- a/lgsm/modules/install_header.sh +++ b/lgsm/modules/install_header.sh @@ -9,7 +9,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" clear fn_print_ascii_logo -fn_sleep_time fn_messages_separator echo -e "${bold}${lightyellow}Linux${default}${bold}GSM_${default}" echo -e "${italic}by Daniel Gibbs${default}" @@ -19,4 +18,3 @@ echo -e "${lightblue}Website:${default} https://linuxgsm.com" echo -e "${lightblue}Contributors:${default} https://linuxgsm.com/contrib" echo -e "${lightblue}Sponsor:${default} https://linuxgsm.com/sponsor" fn_messages_separator -fn_sleep_time diff --git a/lgsm/modules/install_server_files.sh b/lgsm/modules/install_server_files.sh index 8d4cc111c6..2763f470bc 100644 --- a/lgsm/modules/install_server_files.sh +++ b/lgsm/modules/install_server_files.sh @@ -208,7 +208,6 @@ fn_install_server_files() { echo -e "" echo -e "${bold}${lightyellow}Installing ${gamename} Server${default}" fn_messages_separator -fn_sleep_time if [ "${appid}" ]; then remotelocation="SteamCMD" diff --git a/lgsm/modules/install_squad_license.sh b/lgsm/modules/install_squad_license.sh index c207c8fb83..604b3bcad7 100644 --- a/lgsm/modules/install_squad_license.sh +++ b/lgsm/modules/install_squad_license.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${bold}${lightyellow}${gamename} Server License${default}" fn_messages_separator -fn_sleep_time echo -e "Server license is an optional feature for ${gamename} server" fn_script_log_info "Server license is an optional feature for ${gamename} server" diff --git a/lgsm/modules/install_steamcmd.sh b/lgsm/modules/install_steamcmd.sh index c0e8c25c1a..50599ebd53 100644 --- a/lgsm/modules/install_steamcmd.sh +++ b/lgsm/modules/install_steamcmd.sh @@ -10,5 +10,4 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${bold}${lightyellow}Installing SteamCMD${default}" fn_messages_separator -fn_sleep_time check_steamcmd.sh diff --git a/lgsm/modules/install_ts3db.sh b/lgsm/modules/install_ts3db.sh index d2857f47fc..e5776c30f8 100644 --- a/lgsm/modules/install_ts3db.sh +++ b/lgsm/modules/install_ts3db.sh @@ -25,7 +25,6 @@ fn_install_ts3db_mariadb() { echo -e "" echo -e "${bold}${lightyellow}Configure ${gamename} Server for MariaDB${default}" fn_messages_separator - fn_sleep_time read -rp "Enter MariaDB hostname: " mariahostname read -rp "Enter MariaDB port: " mariaport read -rp "Enter MariaDB username: " mariausername @@ -52,7 +51,6 @@ fn_install_ts3db_mariadb() { echo -e "" echo -e "${bold}${lightyellow}Select Database${default}" fn_messages_separator -fn_sleep_time if [ -z "${autoinstall}" ]; then if fn_prompt_yn "Do you want to use MariaDB instead of sqlite? (MariaDB must be pre-configured)" N; then fn_install_ts3db_mariadb @@ -66,7 +64,6 @@ install_eula.sh echo -e "" echo -e "${bold}${lightyellow}Getting Privilege Key${default}" fn_messages_separator -fn_sleep_time fn_print_information_nl "Save these details for later." fn_print_information_nl "Key also saved in:" echo -e "${serverfiles}/privilege_key.txt" diff --git a/lgsm/modules/install_ut2k4_key.sh b/lgsm/modules/install_ut2k4_key.sh index c96039ef5f..6fbd2a838d 100644 --- a/lgsm/modules/install_ut2k4_key.sh +++ b/lgsm/modules/install_ut2k4_key.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${bold}${lightyellow}Enter ${gamename} CD Key${default}" fn_messages_separator -fn_sleep_time echo -e "To get your server listed on the Master Server list" echo -e "you must get a free CD key. Get a key here:" echo -e "https://www.epicgames.com/unrealtournament/forums/cdkey.php?2004"