From 68ae13c0695f1aaa5a1d6e8f711481e15e144542 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 15 Oct 2023 17:52:03 +0100 Subject: [PATCH] feat: change sleep timers (#4339) * refactor: simplify sleep time functions The `fn_sleep_time` function has been refactored to remove unnecessary conditions and set a default sleep time of 0.5 seconds. Additionally, four new functions (`fn_sleep_time_1`, `fn_sleep_time_5`, `fn_sleep_time_10`) have been added to provide different sleep times of 1, 5, and 10 seconds respectively. This improves code readability and allows for more flexibility in setting sleep times. * change sleep to fn_sleep_time * refactor: optimize sleep time functions - Refactored the code to optimize the sleep time functions. - Updated the `fn_sleep_time` function calls to `fn_sleep_time_1` in multiple files. - Removed unnecessary sleep time calls in some files. * refactor: simplify sleep time function call The code changes refactor the sleep time function call in the check_deps.sh file. Instead of calling fn_sleep_time_1, it now calls fn_sleep_time. This change simplifies the code and improves readability. * feat: add sleep time before checking session Add a sleep time of 1 second before checking the session in the command_monitor.sh file. This allows for better synchronization and improves the accuracy of the session check. * changes * refactor: optimize sleep time function The code changes refactor the sleep time function in multiple files to improve efficiency. The fn_sleep_time function is replaced with fn_sleep_time_1. This change reduces unnecessary delays during execution. * refactor: update sleep time function names The sleep time functions in the core_messages.sh file have been updated to use more descriptive names. The fn_sleep_time function has been renamed to fn_sleep_time_1 for clarity and consistency. This change improves code readability and maintainability. * refactor: optimize sleep time in core_messages.sh The commit optimizes the sleep time in the core_messages.sh file. The fn_sleep_time and fn_print_dots functions now use a shorter sleep time of 0.5 seconds instead of 1 second, resulting in faster execution. * refactor: improve readability and consistency in code - Refactored the log messages to use consistent capitalization and wording. - Updated log messages in check_glibc.sh, check_permissions.sh, command_backup.sh, command_update_linuxgsm.sh, command_wipe.sh, fix_samp.sh, install_config.sh, and set_dst_config_vars() functions. feat: add more descriptive log messages - Added more descriptive log messages to provide clearer information about the actions being performed. - Updated log messages in check_glibc.sh, check_permissions.sh, command_backup.sh, command_update_linuxgsm.sh, command_wipe.sh, fix_samp.sh, install_config.sh. fix: correct spelling errors in log messages - Corrected spelling errors in some of the log messages for better clarity. - Updated log messages in check_glibc.sh and fix_samp.sh. * 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. * refactor: improve commit messages for code changes - Refactored check_glibc.sh to improve readability and clarity of error messages. - Refactored check_permissions.sh to provide more informative error messages when checking /sys permissions. - Refactored check_system_requirements.sh to provide clearer warning message when checking RAM requirements. - Refactored command_backup.sh to provide more descriptive messages when starting a backup. * remove legacy code * fix: remove \t * fix: run check_root check root was never running because of logic in linuxgsm.sh * fix: update warning message for missing sudo access The warning message for users without sudo access has been updated to provide clearer instructions. Instead of just suggesting manual installation, it now also suggests running the script as root using `./${selfname} install`. This change improves user experience and helps them resolve dependency installation issues more effectively. * tidy --- .github/workflows/serverlist-validate.sh | 2 +- lgsm/functions/check_status.sh | 2 +- lgsm/functions/command_stop.sh | 2 +- lgsm/modules/check_config.sh | 3 -- lgsm/modules/check_deps.sh | 20 ++++----- lgsm/modules/check_glibc.sh | 18 ++++---- lgsm/modules/check_permissions.sh | 13 +++--- lgsm/modules/check_root.sh | 2 +- lgsm/modules/check_system_requirements.sh | 6 +-- lgsm/modules/check_version.sh | 2 +- lgsm/modules/command_backup.sh | 50 ++++++----------------- lgsm/modules/command_dev_debug.sh | 4 ++ lgsm/modules/command_dev_details.sh | 2 +- lgsm/modules/command_fastdl.sh | 11 +++-- lgsm/modules/command_mods_remove.sh | 6 +-- lgsm/modules/command_mods_update.sh | 2 +- lgsm/modules/command_monitor.sh | 3 +- lgsm/modules/command_start.sh | 3 +- lgsm/modules/command_stop.sh | 15 +++---- lgsm/modules/command_update_linuxgsm.sh | 4 +- lgsm/modules/command_validate.sh | 8 ++-- lgsm/modules/command_wipe.sh | 14 +++---- lgsm/modules/core_messages.sh | 49 +++++++++++++--------- lgsm/modules/fix_kf.sh | 8 ++-- lgsm/modules/fix_kf2.sh | 2 +- lgsm/modules/fix_ro.sh | 10 ++--- lgsm/modules/fix_samp.sh | 4 +- lgsm/modules/fix_ut2k4.sh | 4 +- lgsm/modules/fix_ut3.sh | 2 +- lgsm/modules/info_messages.sh | 4 +- lgsm/modules/install_config.sh | 22 +++++----- lgsm/modules/install_eula.sh | 4 +- lgsm/modules/install_gslt.sh | 4 +- lgsm/modules/install_logs.sh | 2 - lgsm/modules/install_server_dir.sh | 1 - lgsm/modules/install_squad_license.sh | 2 +- lgsm/modules/install_stats.sh | 1 - lgsm/modules/install_ts3db.sh | 4 +- lgsm/modules/update_fctr.sh | 2 +- lgsm/modules/update_jk2.sh | 2 +- lgsm/modules/update_mc.sh | 2 +- lgsm/modules/update_mcb.sh | 2 +- lgsm/modules/update_mta.sh | 2 +- lgsm/modules/update_pmc.sh | 2 +- lgsm/modules/update_ts3.sh | 2 +- lgsm/modules/update_ut99.sh | 2 +- lgsm/modules/update_vints.sh | 2 +- linuxgsm.sh | 19 +++++---- 48 files changed, 171 insertions(+), 181 deletions(-) diff --git a/.github/workflows/serverlist-validate.sh b/.github/workflows/serverlist-validate.sh index 50b2da712..bc192ec37 100755 --- a/.github/workflows/serverlist-validate.sh +++ b/.github/workflows/serverlist-validate.sh @@ -10,7 +10,7 @@ csvlist="$(ls -1 | grep -E '^(ubuntu|debian|centos|rhel|almalinux|rocky).*\.csv$ # loop though each csv file and make sure the number of lines is the same as the serverlistcount for csv in $csvlist; do csvcount="$(wc -l < "${csv}")" - csvcount=$((csvcount-2)) + csvcount=$((csvcount - 2)) if [ "$csvcount" -ne "$serverlistcount" ]; then echo "ERROR: $csv ($csvcount) does not match serverlist.csv ($serverlistcount)" exitcode=1 diff --git a/lgsm/functions/check_status.sh b/lgsm/functions/check_status.sh index a454b4eff..429f7c72d 100644 --- a/lgsm/functions/check_status.sh +++ b/lgsm/functions/check_status.sh @@ -7,4 +7,4 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -status=$(tmux -L "${sessionname}" list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${sessionname}") +status=$(tmux -L "${sessionname}" list-sessions -F "#{session_name}" 2> /dev/null | grep -Ecx "^${sessionname}") diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index d2e88fcea..92785af98 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -15,7 +15,7 @@ fn_stop_graceful_ctrlc() { fn_print_dots "Graceful: CTRL+c" fn_script_log_info "Graceful: CTRL+c" # Sends quit. - tmux -L "${sessionname}" send-keys -t "${sessionname}" C-c > /dev/null 2>&1 + tmux -L "${sessionname}" send-keys -t "${sessionname}" C-c > /dev/null 2>&1 # Waits up to 30 seconds giving the server time to shutdown gracefuly. for seconds in {1..30}; do check_status.sh 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/check_deps.sh b/lgsm/modules/check_deps.sh index d10948ca5..0f8304a18 100644 --- a/lgsm/modules/check_deps.sh +++ b/lgsm/modules/check_deps.sh @@ -25,11 +25,11 @@ fn_install_mono_repo() { fn_print_information_nl "Automatically adding Mono repository." fn_script_log_info "Automatically adding Mono repository." echo -en ".\r" - sleep 1 + fn_sleep_time_1 echo -en "..\r" - sleep 1 + fn_sleep_time_1 echo -en "...\r" - sleep 1 + fn_sleep_time_1 echo -en " \r" if [ "${distroid}" == "ubuntu" ]; then if [ "${distroversion}" == "22.04" ]; then @@ -160,8 +160,8 @@ fn_install_missing_deps() { fn_print_information_nl "$(whoami) has sudo access." fn_script_log_info "$(whoami) has sudo access." else - fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies." - fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies." + fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies or run ./${selfname} install as root." + fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies or run ./${selfname} install as root." fi fi @@ -177,11 +177,11 @@ fn_install_missing_deps() { fn_print_information_nl "Automatically installing missing dependencies." fn_script_log_info "Automatically installing missing dependencies." echo -en ".\r" - sleep 1 + fn_sleep_time_1 echo -en "..\r" - sleep 1 + fn_sleep_time_1 echo -en "...\r" - sleep 1 + fn_sleep_time_1 echo -en " \r" if [ "$(command -v apt 2> /dev/null)" ]; then cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; ${i386installcommand}sudo apt-get update; sudo apt-get -y install ${array_deps_missing[*]}" @@ -306,14 +306,14 @@ fn_deps_detector() { missingdep=0 if [ "${commandname}" == "INSTALL" ]; then echo -e "${green}${deptocheck}${default}" - sleep 0.1 + fn_sleep_time fi elif [ "${depstatus}" != "0" ]; then # If dependency is not found. missingdep=1 if [ "${commandname}" == "INSTALL" ]; then echo -e "${red}${deptocheck}${default}" - sleep 0.1 + fn_sleep_time fi # If SteamCMD requirements are not met install will fail. if [ -n "${appid}" ]; then diff --git a/lgsm/modules/check_glibc.sh b/lgsm/modules/check_glibc.sh index 25357a461..9da491bce 100644 --- a/lgsm/modules/check_glibc.sh +++ b/lgsm/modules/check_glibc.sh @@ -13,17 +13,19 @@ if [ "${glibc}" == "null" ]; then # Glibc is not required. : elif [ -z "${glibc}" ]; then - fn_print_dots "glibc" - fn_print_error_nl "glibc requirement unknown" - fn_script_log_error "glibc requirement unknown" + fn_print_dots "Checking glibc" + fn_print_error_nl "Checking glibc: requirement unknown" + fn_script_log_error "Checking glibc: requirement unknown" + fn_sleep_time_5 elif [ "$(printf '%s\n'${glibc}'\n' "${glibcversion}" | sort -V | head -n 1)" != "${glibc}" ]; then - fn_print_dots "glibc" - fn_print_error_nl "glibc requirements not met" - fn_script_log_error "glibc requirements not met" + fn_print_dots "Checking glibc" + fn_print_error_nl "Checking glibc: requirements not met" + fn_script_log_error "Checking glibc: requirements not met" echo -en "\n" echo -e " * glibc required: ${glibc}" echo -e " * glibc installed: ${red}${glibcversion}${default}" echo -en "\n" - fn_print_information_nl "distro upgrade is required" - fn_script_log_info "distro upgrade is required" + fn_print_information_nl "Distro upgrade is required" + fn_script_log_info "Distro upgrade is required" + fn_sleep_time_5 fi diff --git a/lgsm/modules/check_permissions.sh b/lgsm/modules/check_permissions.sh index a6a37ce5c..572b403cc 100644 --- a/lgsm/modules/check_permissions.sh +++ b/lgsm/modules/check_permissions.sh @@ -171,7 +171,7 @@ fn_sys_perm_fix_manually_msg() { fn_script_log_info "To fix this issue, run the following command as root:" echo -e " chmod a+rx /sys /sys/class /sys/class/net" fn_script_log "chmod a+rx /sys /sys/class /sys/class/net" - fn_sleep_time + fn_sleep_time_5 if [ "${monitorflag}" == 1 ]; then alert="permissions" alert.sh @@ -182,8 +182,8 @@ fn_sys_perm_fix_manually_msg() { # Attempt to fix /sys related permission errors if sudo is available, exits otherwise. fn_sys_perm_errors_fix() { if sudo -n true > /dev/null 2>&1; then - fn_print_dots "Automatically fixing /sys permissions" - fn_script_log_info "Automatically fixing /sys permissions." + fn_print_dots "Fixing /sys permissions" + fn_script_log_info "Fixing /sys permissions." if [ "${sysdirpermerror}" == "1" ]; then sudo chmod a+rx "/sys" fi @@ -202,7 +202,7 @@ fn_sys_perm_errors_fix() { # Show the user how to fix. fn_sys_perm_fix_manually_msg else - fn_print_ok_nl "Automatically fixing /sys permissions" + fn_print_ok_nl "Fixing /sys permissions" fn_script_log_pass "Permissions in /sys fixed" fi else @@ -216,8 +216,9 @@ fn_sys_perm_error_process() { fn_sys_perm_errors_detect # If any error was found. if [ "${sysdirpermerror}" == "1" ] || [ "${classdirpermerror}" == "1" ] || [ "${netdirpermerror}" == "1" ]; then - fn_print_error_nl "Permission error(s) found in /sys" - fn_script_log_error "Permission error(s) found in /sys" + fn_print_dots "Checking /sys permissions" + fn_print_error_nl "Checking /sys permissions" + fn_script_log_error "Checking /sys permissions" # Run the fix fn_sys_perm_errors_fix fi diff --git a/lgsm/modules/check_root.sh b/lgsm/modules/check_root.sh index 81115394a..8fe20764c 100644 --- a/lgsm/modules/check_root.sh +++ b/lgsm/modules/check_root.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "$(whoami)" == "root" ]; then if [ "${commandname}" != "INSTALL" ]; then - fn_print_fail_nl "Do NOT run this script as root!" + fn_print_fail_nl "Do NOT run as root!" if [ -d "${lgsmlogdir}" ]; then fn_script_log_fail "${selfname} attempted to run as root." else diff --git a/lgsm/modules/check_system_requirements.sh b/lgsm/modules/check_system_requirements.sh index 88fb9d15a..6932de4dc 100644 --- a/lgsm/modules/check_system_requirements.sh +++ b/lgsm/modules/check_system_requirements.sh @@ -46,10 +46,10 @@ fi # If the game or engine has a minimum RAM Requirement, compare it to system's available RAM. if [ "${ramrequirementmb}" ]; then if [ "${physmemtotalmb}" -lt "${ramrequirementmb}" ]; then - fn_print_dots "Check RAM" + fn_print_dots "Checking RAM" # Warn the user. - fn_print_warn_nl "Check RAM: ${ramrequirementgb}G required, ${physmemtotal} available" + fn_print_warn_nl "Checking RAM: ${ramrequirementgb}G required, ${physmemtotal} available" echo "* ${gamename} server may fail to run or experience poor performance." - fn_sleep_time + fn_sleep_time_5 fi fi diff --git a/lgsm/modules/check_version.sh b/lgsm/modules/check_version.sh index 3ca015843..5369fd832 100644 --- a/lgsm/modules/check_version.sh +++ b/lgsm/modules/check_version.sh @@ -16,8 +16,8 @@ if [ -n "${modulesversion}" ] && [ -n "${version}" ] && [ "${version}" != "${mod echo -e "* ${selfname}: ${version}" echo -e "* modules: ${modulesversion}" echo -e "" - fn_sleep_time fn_script_log_error "LinuxGSM Version mismatch: ${selfname}: ${version}: modules: ${modulesversion}" + fn_sleep_time_1 command_update_linuxgsm.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/command_backup.sh b/lgsm/modules/command_backup.sh index 16223c914..fac5dc38b 100644 --- a/lgsm/modules/command_backup.sh +++ b/lgsm/modules/command_backup.sh @@ -10,8 +10,6 @@ commandaction="Backing up" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set -check.sh - # Trap to remove lockfile on quit. fn_backup_trap() { echo -e "" @@ -56,12 +54,14 @@ fn_backup_init() { backupname="${selfname}-$(date '+%Y-%m-%d-%H%M%S')" info_distro.sh - fn_print_dots "Backup starting" - fn_script_log_info "Backup starting" - fn_print_ok_nl "Backup starting" + fn_print_dots "Starting backup" + fn_script_log_info "Starting backup" if [ ! -d "${backupdir}" ] || [ "${backupcount}" == "0" ]; then - fn_print_info_nl "There are no previous backups" + fn_print_info_nl "Starting backup: No previous backups found" + fn_script_log_info "No previous backups found" else + fn_print_info_nl "Starting backup: Previous backups found" + fn_script_log_info "Previous backups found" if [ "${lastbackupdaysago}" == "0" ]; then daysago="less than 1 day ago" elif [ "${lastbackupdaysago}" == "1" ]; then @@ -101,32 +101,6 @@ fn_backup_dir() { fi } -# Migrate Backups from old dir before refactor -fn_backup_migrate_olddir() { - # Check if old backup dir is there before the refactor and move the backups - if [ -d "${rootdir}/backups" ]; then - if [ "${rootdir}/backups" != "${backupdir}" ]; then - fn_print_dots "Backup directory is being migrated" - fn_script_log_info "Backup directory is being migrated" - fn_script_log_info "${rootdir}/backups > ${backupdir}" - mv "${rootdir}/backups/"* "${backupdir}" 2> /dev/null - exitcode=$? - if [ "${exitcode}" == 0 ]; then - rmdir "${rootdir}/backups" 2> /dev/null - exitcode=$? - fi - if [ "${exitcode}" != 0 ]; then - fn_print_error_nl "Backup directory is being migrated" - fn_script_log_error "Backup directory is being migrated" - else - - fn_print_ok_nl "Backup directory is being migrated" - fn_script_log_pass "Backup directory is being migrated" - fi - fi - fi -} - fn_backup_create_lockfile() { # Create lockfile. date '+%s' > "${lockdir:?}/backup.lock" @@ -142,7 +116,7 @@ fn_backup_compression() { fn_print_info "A total of ${rootdirduexbackup} will be compressed." fn_script_log_info "A total of ${rootdirduexbackup} will be compressed: ${backupdir}/${backupname}.tar.gz" fn_print_dots "Backup (${rootdirduexbackup}) ${backupname}.tar.gz, in progress..." - fn_script_log_info "backup ${rootdirduexbackup} ${backupname}.tar.gz, in progress" + fn_script_log_info "Backup ${rootdirduexbackup} ${backupname}.tar.gz, in progress" excludedir=$(fn_backup_relpath) # Check that excludedir is a valid path. @@ -187,7 +161,7 @@ fn_backup_prune() { # Display how many backups will be cleared. echo -e "* Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit" fn_script_log_info "Pruning: ${backupquotadiff} backup(s) has exceeded the ${maxbackups} backups limit" - fn_sleep_time + fn_sleep_time_1 fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)" fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)" # Clear backups over quota. @@ -199,7 +173,7 @@ fn_backup_prune() { # Display how many backups will be cleared. echo -e "* Pruning: ${backupsoudatedcount} backup(s) are older than ${maxbackupdays} days." fn_script_log_info "Pruning: ${backupsoudatedcount} backup(s) older than ${maxbackupdays} days." - fn_sleep_time + fn_sleep_time_1 fn_print_dots "Pruning: Clearing ${backupquotadiff} backup(s)." fn_script_log_info "Pruning: Clearing ${backupquotadiff} backup(s)" # Clear backups over quota @@ -264,12 +238,14 @@ 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 fn_backup_dir -fn_backup_migrate_olddir fn_backup_create_lockfile fn_backup_compression fn_backup_prune 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_dev_details.sh b/lgsm/modules/command_dev_details.sh index 2659465d3..93dae77bc 100644 --- a/lgsm/modules/command_dev_details.sh +++ b/lgsm/modules/command_dev_details.sh @@ -19,8 +19,8 @@ carriagereturn=$(file -b "${servercfgfullpath}" | grep -q CRLF && echo "${red}CR echo -e "" echo -e "${bold}${lightgreen}Server Details${default}" fn_messages_separator -echo -e "" +echo -e "" echo -e "Game: ${gamename}" echo -e "Config type: ${configtype}" echo -e "Config file: ${servercfgfullpath}" diff --git a/lgsm/modules/command_fastdl.sh b/lgsm/modules/command_fastdl.sh index acc3a1ba4..c1c667797 100644 --- a/lgsm/modules/command_fastdl.sh +++ b/lgsm/modules/command_fastdl.sh @@ -10,8 +10,6 @@ commandaction="Fastdl" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set -check.sh - # Directories. if [ -z "${webdir}" ]; then webdir="${rootdir}/public_html" @@ -209,7 +207,7 @@ fn_fastdl_preview() { fi if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then echo -e "calculating total file size..." - fn_sleep_time + fn_sleep_time_1 totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt") # Calculates total file size. while read -r dufile; do @@ -276,7 +274,7 @@ fn_fastdl_gmod() { fi # Clear addons directory in fastdl. echo -en "clearing addons dir from fastdl dir..." - fn_sleep_time + fn_sleep_time_1 rm -rf "${fastdldir:?}/addons" exitcode=$? if [ "${exitcode}" != 0 ]; then @@ -291,7 +289,7 @@ fn_fastdl_gmod() { # Correct content that may be into a lua directory by mistake like some darkrpmodification addons. if [ -d "${fastdldir}/lua" ]; then echo -en "correcting DarkRP files..." - fn_sleep_time + fn_sleep_time_1 cp -Rf "${fastdldir}/lua/"* "${fastdldir}" exitcode=$? if [ "${exitcode}" != 0 ]; then @@ -335,7 +333,7 @@ fn_fastdl_source() { tput rc tput el echo -e "copying ${directory} ${allowed_extention} : ${fileswc}..." - fn_sleep_time + fn_sleep_time_1 # get relative path of file in the dir tmprelfilepath="${fastdlfile#"${systemdir}/"}" copytodir="${tmprelfilepath%/*}" @@ -427,6 +425,7 @@ fn_fastdl_bzip2() { fn_print_ok_eol_nl } +check.sh # Run functions. fn_fastdl_preview fn_clear_old_fastdl diff --git a/lgsm/modules/command_mods_remove.sh b/lgsm/modules/command_mods_remove.sh index db7763cd8..5f70ac389 100644 --- a/lgsm/modules/command_mods_remove.sh +++ b/lgsm/modules/command_mods_remove.sh @@ -59,7 +59,7 @@ fn_script_log_info "Removing ${modsfilelistsize} files from ${modprettyname}" echo -e "removing ${modprettyname}" echo -e "* ${modsfilelistsize} files to be removed" echo -e "* location: ${modinstalldir}" -fn_sleep_time +fn_sleep_time_1 # Go through every file and remove it. modfileline="1" tput sc @@ -99,7 +99,7 @@ fi # Remove file list. echo -en "removing ${modcommand}-files.txt..." -fn_sleep_time +fn_sleep_time_1 rm -rf "${modsdir:?}/${modcommand}-files.txt" exitcode=$? if [ "${exitcode}" != 0 ]; then @@ -113,7 +113,7 @@ fi # Remove mods from installed mods list. echo -en "removing ${modcommand} from ${modsinstalledlist}..." -fn_sleep_time +fn_sleep_time_1 sed -i "/^${modcommand}$/d" "${modsinstalledlistfullpath}" exitcode=$? diff --git a/lgsm/modules/command_mods_update.sh b/lgsm/modules/command_mods_update.sh index cfbafc80c..cd5c3b03f 100644 --- a/lgsm/modules/command_mods_update.sh +++ b/lgsm/modules/command_mods_update.sh @@ -18,7 +18,7 @@ mods_core.sh fn_remove_cfg_files() { if [ "${modkeepfiles}" != "OVERWRITE" ] && [ "${modkeepfiles}" != "NOUPDATE" ]; then echo -e "the following files/directories will be preserved:" - fn_sleep_time + fn_sleep_time_1 # Count how many files there are to remove. filestopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' '{ print NF }') # Test all subvalues of "modkeepfiles" using the ";" separator. diff --git a/lgsm/modules/command_monitor.sh b/lgsm/modules/command_monitor.sh index 079ad334d..d4d88bd56 100644 --- a/lgsm/modules/command_monitor.sh +++ b/lgsm/modules/command_monitor.sh @@ -330,7 +330,7 @@ fn_monitor_query() { # Second counter will wait for 15s before breaking loop. for seconds in {1..15}; do fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt} : ${cyan}WAIT${default}" - sleep 0.5 + fn_sleep_time_1 totalseconds=$((totalseconds + 1)) if [ "${seconds}" == "15" ]; then break @@ -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 4b45f0bc3..364733ea2 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -114,7 +114,7 @@ fn_start_tmux() { echo -e "Console logging disabled in settings" >> "${consolelog}" fn_script_log_info "Console logging disabled by user" fi - fn_sleep_time + fn_sleep_time_1 # If the server fails to start. check_status.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 ee9152862..1567252f9 100644 --- a/lgsm/modules/command_stop.sh +++ b/lgsm/modules/command_stop.sh @@ -25,7 +25,7 @@ fn_stop_graceful_ctrlc() { fn_script_log_pass "Graceful: CTRL+c: OK: ${seconds} seconds" break fi - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: CTRL+c: ${seconds}" done check_status.sh @@ -53,7 +53,7 @@ fn_stop_graceful_cmd() { fn_script_log_pass "Graceful: sending \"${1}\": OK: ${seconds} seconds" break fi - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: sending \"${1}\": ${seconds}" done check_status.sh @@ -74,7 +74,7 @@ fn_stop_graceful_goldsrc() { tmux -L "${socketname}" send -t "${sessionname}" quit ENTER > /dev/null 2>&1 # Waits 3 seconds as goldsrc servers restart with the quit command. for seconds in {1..3}; do - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: sending \"quit\": ${seconds}" done fn_print_ok "Graceful: sending \"quit\": ${seconds}: " @@ -154,7 +154,7 @@ fn_stop_graceful_sdtd() { fn_script_log_pass "Graceful: telnet: ${telnetip}:${telnetport} : ${seconds} seconds" break fi - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: telnet: ${seconds}" done # If telnet shutdown fails tmux shutdown will be used, this risks loss of world save. @@ -185,7 +185,7 @@ fn_stop_graceful_avorion() { fn_script_log_info "Graceful: /save /stop" # Sends /save. tmux -L "${socketname}" send-keys -t "${sessionname}" /save ENTER > /dev/null 2>&1 - sleep 5 + fn_sleep_time_5 # Sends /quit. tmux -L "${socketname}" send-keys -t "${sessionname}" /stop ENTER > /dev/null 2>&1 # Waits up to 30 seconds giving the server time to shutdown gracefuly. @@ -197,7 +197,7 @@ fn_stop_graceful_avorion() { fn_script_log_pass "Graceful: /save /stop: OK: ${seconds} seconds" break fi - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: /save /stop: ${seconds}" done check_status.sh @@ -241,7 +241,7 @@ fn_stop_tmux() { fn_script_log_info "tmux kill-session: ${sessionname}: ${servername}" # Kill tmux session. tmux -L "${socketname}" kill-session -t "${sessionname}" > /dev/null 2>&1 - sleep 0.5 + fn_sleep_time_1 check_status.sh if [ "${status}" == "0" ]; then fn_print_ok_nl "${servername}" @@ -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 65b72bcbb..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" @@ -92,7 +92,7 @@ if [ "${script_diff}" != "" ]; then fi echo -en "copying ${selfname}...\c" - fn_script_log_info "copying ${selfname}" + fn_script_log_info "Copying ${selfname}" cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}" sed -i "s+shortname=\"core\"+shortname=\"${shortname}\"+g" "${rootdir}/${selfname}" sed -i "s+gameservername=\"core\"+gameservername=\"${gameservername}\"+g" "${rootdir}/${selfname}" diff --git a/lgsm/modules/command_validate.sh b/lgsm/modules/command_validate.sh index f4a6250f3..d3511d7bb 100644 --- a/lgsm/modules/command_validate.sh +++ b/lgsm/modules/command_validate.sh @@ -17,7 +17,7 @@ fn_validate() { for seconds in {3..1}; do fn_print_warn "Validate might overwrite some customised files: ${totalseconds}" totalseconds=$((totalseconds - 1)) - sleep 1 + fn_sleep_time_1 if [ "${seconds}" == "0" ]; then break fi @@ -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 diff --git a/lgsm/modules/command_wipe.sh b/lgsm/modules/command_wipe.sh index 193d2cd2d..d20bd0d3e 100644 --- a/lgsm/modules/command_wipe.sh +++ b/lgsm/modules/command_wipe.sh @@ -30,7 +30,7 @@ fn_wipe_files() { if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]; then echo -en "removing .map file(s)..." - fn_script_log_info "removing *.map file(s)" + fn_script_log_info "Removing *.map file(s)" fn_sleep_time find "${serveridentitydir:?}" -type f -name "*.map" -printf "%f\n" >> "${lgsmlog}" find "${serveridentitydir:?}" -type f -name "*.map" -delete | tee -a "${lgsmlog}" @@ -45,7 +45,7 @@ fn_wipe_files() { if [ -n "${serverwipe}" ] || [ -n "${mapwipe}" ]; then if [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]; then echo -en "removing .sav file(s)..." - fn_script_log_info "removing .sav file(s)" + fn_script_log_info "Removing .sav file(s)" fn_sleep_time find "${serveridentitydir:?}" -type f -name "*.sav*" -printf "%f\n" >> "${lgsmlog}" find "${serveridentitydir:?}" -type f -name "*.sav*" -delete @@ -61,7 +61,7 @@ fn_wipe_files() { if [ -n "${serverwipe}" ]; then if [ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then echo -en "removing .db file(s)..." - fn_script_log_info "removing .db file(s)" + fn_script_log_info "Removing .db file(s)" fn_sleep_time find "${serveridentitydir:?}" -type f ! -name 'player.tokens.db' -name "*.db" -printf "%f\n" >> "${lgsmlog}" find "${serveridentitydir:?}" -type f ! -name 'player.tokens.db' -name "*.db" -delete @@ -79,9 +79,9 @@ fn_map_wipe_warning() { fn_script_log_warn "Map wipe will reset the map data and keep blueprint data" totalseconds=3 for seconds in {3..1}; do - fn_print_warn "Map wipe will reset the map data and keep blueprint data: ${totalseconds}" + fn_print_warn "map wipe will reset the map data and keep blueprint data: ${totalseconds}" totalseconds=$((totalseconds - 1)) - sleep 1 + fn_sleep_time_1 if [ "${seconds}" == "0" ]; then break fi @@ -94,9 +94,9 @@ fn_full_wipe_warning() { fn_script_log_warn "Server wipe will reset the map data and remove blueprint data" totalseconds=3 for seconds in {3..1}; do - fn_print_warn "Server wipe will reset the map data and remove blueprint data: ${totalseconds}" + fn_print_warn "server wipe will reset the map data and remove blueprint data: ${totalseconds}" totalseconds=$((totalseconds - 1)) - sleep 1 + fn_sleep_time_1 if [ "${seconds}" == "0" ]; then break fi diff --git a/lgsm/modules/core_messages.sh b/lgsm/modules/core_messages.sh index 5af4c5639..929e942be 100644 --- a/lgsm/modules/core_messages.sh +++ b/lgsm/modules/core_messages.sh @@ -35,12 +35,23 @@ fn_ansi_loader() { } fn_sleep_time() { - if [ "${sleeptime}" != "0" ] || [ "${travistest}" != "1" ]; then - if [ -z "${sleeptime}" ]; then - sleeptime=0.5 - fi - sleep "${sleeptime}" - fi + sleep "0.1" +} + +fn_sleep_time_05() { + sleep "0.5" +} + +fn_sleep_time_1() { + sleep "1" +} + +fn_sleep_time_5() { + sleep "5" +} + +fn_sleep_time_10() { + sleep "10" } # Log display @@ -137,7 +148,7 @@ fn_print_dots() { else echo -en "${creeol}[ .... ] $*" fi - fn_sleep_time + fn_sleep_time_05 } fn_print_dots_nl() { @@ -146,7 +157,7 @@ fn_print_dots_nl() { else echo -e "${creeol}[ .... ] $*" fi - fn_sleep_time + fn_sleep_time_05 echo -en "\n" } @@ -476,56 +487,56 @@ fn_print_info_eol_nl() { # QUERYING fn_print_querying_eol() { echo -en "${cyan}QUERYING${default}" - fn_sleep_time + fn_sleep_time_1 } fn_print_querying_eol_nl() { echo -e "${cyan}QUERYING${default}" - fn_sleep_time + fn_sleep_time_1 } # CHECKING fn_print_checking_eol() { echo -en "${cyan}CHECKING${default}" - fn_sleep_time + fn_sleep_time_1 } fn_print_checking_eol_nl() { echo -e "${cyan}CHECKING${default}" - fn_sleep_time + fn_sleep_time_1 } # DELAY fn_print_delay_eol() { echo -en "${green}DELAY${default}" - fn_sleep_time + fn_sleep_time_1 } fn_print_delay_eol_nl() { echo -e "${green}DELAY${default}" - fn_sleep_time + fn_sleep_time_1 } # CANCELED fn_print_canceled_eol() { echo -en "${lightyellow}CANCELED${default}" - fn_sleep_time + fn_sleep_time_1 } fn_print_canceled_eol_nl() { echo -e "${lightyellow}CANCELED${default}" - fn_sleep_time + fn_sleep_time_1 } # REMOVED fn_print_removed_eol() { echo -en "${red}REMOVED${default}" - fn_sleep_time + fn_sleep_time_1 } fn_print_removed_eol_nl() { echo -e "${red}REMOVED${default}" - fn_sleep_time + fn_sleep_time_1 } # UPDATE @@ -582,7 +593,7 @@ fn_print_restart_warning() { for seconds in {3..1}; do fn_print_warn "${selfname} will be restarted: ${totalseconds}" totalseconds=$((totalseconds - 1)) - sleep 1 + fn_sleep_time_1 if [ "${seconds}" == "0" ]; then break fi diff --git a/lgsm/modules/fix_kf.sh b/lgsm/modules/fix_kf.sh index fe8b574aa..1bec47a4b 100644 --- a/lgsm/modules/fix_kf.sh +++ b/lgsm/modules/fix_kf.sh @@ -7,12 +7,12 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -echo -e "Applying WebAdmin ROOst.css fix." +echo -e "applying WebAdmin ROOst.css fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css" sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css" fn_sleep_time -echo -e "Applying WebAdmin CharSet fix." +echo -e "applying WebAdmin CharSet fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int" fn_sleep_time @@ -23,14 +23,14 @@ fn_sleep_time exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_kf2.sh b/lgsm/modules/fix_kf2.sh index 13176d448..cb4707414 100644 --- a/lgsm/modules/fix_kf2.sh +++ b/lgsm/modules/fix_kf2.sh @@ -13,7 +13,7 @@ fn_print_information "starting ${gamename} server to generate configs." exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 10 +fn_sleep_time_10 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_ro.sh b/lgsm/modules/fix_ro.sh index 6ae485dbe..72864d699 100644 --- a/lgsm/modules/fix_ro.sh +++ b/lgsm/modules/fix_ro.sh @@ -7,16 +7,16 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -echo -e "Applying webinterface ROOst.css fix." +echo -e "applying webinterface ROOst.css fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css" sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css" fn_sleep_time -echo -e "Applying webinterface CharSet fix." +echo -e "applying webinterface CharSet fix." echo -e "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1" sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/uweb.int" fn_sleep_time -echo -e "Applying Steam AppID fix." +echo -e "applying Steam AppID fix." sed -i 's/1210/1200/g' "${systemdir}/steam_appid.txt" fn_sleep_time echo -e "applying server name fix." @@ -26,14 +26,14 @@ fn_sleep_time exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_samp.sh b/lgsm/modules/fix_samp.sh index 24882f915..0b5d0ab22 100644 --- a/lgsm/modules/fix_samp.sh +++ b/lgsm/modules/fix_samp.sh @@ -15,7 +15,7 @@ if [ -f "${servercfgfullpath}" ]; then if [ "${currentpass}" == "${defaultpass}" ]; then fixname="change default rcon password" fn_fix_msg_start - fn_script_log_info "changing rcon/admin password." + fn_script_log_info "Changing rcon/admin password." randomstring=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs) rconpass="admin${randomstring}" sed -i "s/rcon_password changeme/rcon_password ${rconpass}/g" "${servercfgfullpath}" @@ -27,7 +27,7 @@ if [ -f "${servercfgfullpath}" ]; then if [ "${currenthostname}" == "${defaulthostname}" ]; then fixname="change default hostname" fn_fix_msg_start - fn_script_log_info "changing default hostname to LinuxGSM" + fn_script_log_info "Changing default hostname to LinuxGSM" sed -i "s/hostname ${defaulthostname}/hostname LinuxGSM/g" "${servercfgfullpath}" fn_fix_msg_end fi diff --git a/lgsm/modules/fix_ut2k4.sh b/lgsm/modules/fix_ut2k4.sh index 2f7fc0d4d..5da1eee12 100644 --- a/lgsm/modules/fix_ut2k4.sh +++ b/lgsm/modules/fix_ut2k4.sh @@ -23,14 +23,14 @@ fn_sleep_time exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_ut3.sh b/lgsm/modules/fix_ut3.sh index d725de4a2..386833efc 100644 --- a/lgsm/modules/fix_ut3.sh +++ b/lgsm/modules/fix_ut3.sh @@ -13,7 +13,7 @@ fn_print_information "starting ${gamename} server to generate configs." exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 10 +fn_sleep_time_10 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/info_messages.sh b/lgsm/modules/info_messages.sh index 3f0c6d235..c959df307 100644 --- a/lgsm/modules/info_messages.sh +++ b/lgsm/modules/info_messages.sh @@ -143,8 +143,8 @@ fn_info_message_server_resource() { { echo -e "${lightyellow}Storage${default}" echo -e "${lightblue}Filesystem:\t${default}${filesystem}" - echo -e "${lightblue}Total:\t\t${default}${totalspace}" - echo -e "${lightblue}Used:\t\t${default}${usedspace}" + echo -e "${lightblue}Total:\t${default}${totalspace}" + echo -e "${lightblue}Used:\t${default}${usedspace}" echo -e "${lightblue}Available:\t${default}${availspace}" } | column -s $'\t' -t echo -e "" diff --git a/lgsm/modules/install_config.sh b/lgsm/modules/install_config.sh index 1e3c243ab..258a7744a 100644 --- a/lgsm/modules/install_config.sh +++ b/lgsm/modules/install_config.sh @@ -11,7 +11,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_check_cfgdir() { if [ ! -d "${servercfgdir}" ]; then echo -e "creating ${servercfgdir} config directory." - fn_script_log_info "creating ${servercfgdir} config directory." + fn_script_log_info "Creating ${servercfgdir} config directory." mkdir -pv "${servercfgdir}" fi } @@ -25,7 +25,7 @@ fn_fetch_default_config() { echo -e "" echo -e "${italic}https://github.com/GameServerManagers/Game-Server-Configs${default}" echo -e "" - fn_sleep_time + fn_sleep_time_1 mkdir -p "${lgsmdir}/config-default/config-game" githuburl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/main" for config in "${array_configs[@]}"; do @@ -38,7 +38,7 @@ fn_default_config_remote() { for config in "${array_configs[@]}"; do # every config is copied echo -e "copying ${config} config file." - fn_script_log_info "copying ${servercfg} config file." + fn_script_log_info "Copying ${servercfg} config file." if [ "${config}" == "${servercfgdefault}" ]; then mkdir -p "${servercfgdir}" cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}" @@ -82,7 +82,7 @@ fn_set_config_vars() { servername="LinuxGSM" rconpass="admin${randomstring}" echo -e "changing hostname." - fn_script_log_info "changing hostname." + fn_script_log_info "Changing hostname." fn_sleep_time # prevents var from being overwritten with the servername. if grep -q "SERVERNAME=SERVERNAME" "${lgsmdir}/config-default/config-game/${config}" 2> /dev/null; then @@ -93,7 +93,7 @@ fn_set_config_vars() { sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}" fi echo -e "changing rcon/admin password." - fn_script_log_info "changing rcon/admin password." + fn_script_log_info "Changing rcon/admin password." if [ "${shortname}" == "squad" ]; then sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgdir}/Rcon.cfg" else @@ -112,15 +112,15 @@ fn_set_dst_config_vars() { ## cluster.ini if grep -Fq "SERVERNAME" "${clustercfgfullpath}"; then echo -e "changing server name." - fn_script_log_info "changing server name." + fn_script_log_info "Changing server name." sed -i "s/SERVERNAME/LinuxGSM/g" "${clustercfgfullpath}" fn_sleep_time echo -e "changing shard mode." - fn_script_log_info "changing shard mode." + fn_script_log_info "Changing shard mode." sed -i "s/USESHARDING/${sharding}/g" "${clustercfgfullpath}" fn_sleep_time echo -e "randomizing cluster key." - fn_script_log_info "randomizing cluster key." + fn_script_log_info "Randomizing cluster key." randomstring=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2> /dev/null | head -c 8 | xargs) sed -i "s/CLUSTERKEY/${randomstring}/g" "${clustercfgfullpath}" fn_sleep_time @@ -139,18 +139,18 @@ fn_set_dst_config_vars() { fi echo -e "changing shard name." - fn_script_log_info "changing shard name." + fn_script_log_info "Changing shard name." sed -i "s/SHARDNAME/${shard}/g" "${servercfgfullpath}" fn_sleep_time echo -e "changing master setting." - fn_script_log_info "changing master setting." + fn_script_log_info "Changing master setting." sed -i "s/ISMASTER/${master}/g" "${servercfgfullpath}" fn_sleep_time ## worldgenoverride.lua if [ "${cave}" == "true" ]; then echo -e "defining ${shard} as cave in ${servercfgdir}/worldgenoverride.lua." - fn_script_log_info "defining ${shard} as cave in ${servercfgdir}/worldgenoverride.lua." + fn_script_log_info "Defining ${shard} as cave in ${servercfgdir}/worldgenoverride.lua." echo 'return { override_enabled = true, preset = "DST_CAVE", }' > "${servercfgdir}/worldgenoverride.lua" fi fn_sleep_time diff --git a/lgsm/modules/install_eula.sh b/lgsm/modules/install_eula.sh index 7f0229bfa..7f7f95f35 100644 --- a/lgsm/modules/install_eula.sh +++ b/lgsm/modules/install_eula.sh @@ -30,10 +30,10 @@ if [ -z "${autoinstall}" ]; then fi elif [ "${commandname}" == "START" ]; then fn_print_info "By continuing you are indicating your agreement to the EULA." - sleep 5 + fn_sleep_time_5 else echo -e "By using auto-install you are indicating your agreement to the EULA." - sleep 5 + fn_sleep_time_5 fi if [ "${shortname}" == "ts3" ]; then diff --git a/lgsm/modules/install_gslt.sh b/lgsm/modules/install_gslt.sh index 772885d64..aa8d89d33 100644 --- a/lgsm/modules/install_gslt.sh +++ b/lgsm/modules/install_gslt.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${bold}${lightyellow}Game Server Login Token${default}" fn_messages_separator -fn_sleep_time if [ "${shortname}" == "csgo" ] || [ "${shortname}" == "css" ] || [ "${shortname}" == "nmrih" ] || [ "${shortname}" == "bs" ]; then echo -e "GSLT is required to run a public ${gamename} server" fn_script_log_info "GSLT is required to run a public ${gamename} server" @@ -36,7 +35,7 @@ if [ -z "${autoinstall}" ]; then fi fi fi -fn_sleep_time + if [ "${shortname}" == "tu" ]; then echo -e "The GSLT can be changed by editing ${servercfgdir}/${servercfg}." fn_script_log_info "The GSLT can be changed by editing ${servercfgdir}/${servercfg}." @@ -44,4 +43,5 @@ else echo -e "The GSLT can be changed by editing ${configdirserver}/${selfname}.cfg." fn_script_log_info "The GSLT can be changed by editing ${configdirserver}/${selfname}.cfg." fi +fn_sleep_time_1 echo -e "" diff --git a/lgsm/modules/install_logs.sh b/lgsm/modules/install_logs.sh index 5b12dd3e1..294bc1e46 100644 --- a/lgsm/modules/install_logs.sh +++ b/lgsm/modules/install_logs.sh @@ -11,9 +11,7 @@ if [ "${checklogs}" != "1" ]; then echo -e "" echo -e "${bold}${lightyellow}Creating Log Directories${default}" fn_messages_separator - fn_sleep_time fi -fn_sleep_time # Create LinuxGSM logs. echo -en "installing log dir: ${logdir}..." mkdir -p "${logdir}" diff --git a/lgsm/modules/install_server_dir.sh b/lgsm/modules/install_server_dir.sh index 0136e52fc..0703e0c54 100644 --- a/lgsm/modules/install_server_dir.sh +++ b/lgsm/modules/install_server_dir.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${bold}${lightyellow}Server Directory${default}" fn_messages_separator -fn_sleep_time if [ -d "${serverfiles}" ]; then fn_print_warning_nl "A server is already installed here." fi diff --git a/lgsm/modules/install_squad_license.sh b/lgsm/modules/install_squad_license.sh index 604b3bcad..28f4456a5 100644 --- a/lgsm/modules/install_squad_license.sh +++ b/lgsm/modules/install_squad_license.sh @@ -18,7 +18,7 @@ echo -e "https://squad.fandom.com/wiki/Server_licensing" fn_script_log_info "Get more info and a server license here:" fn_script_log_info "https://squad.fandom.com/wiki/Server_licensing" echo -e "" -fn_sleep_time +fn_sleep_time_1 echo -e "The Squad server license can be changed by editing ${servercfgdir}/License.cfg." fn_script_log_info "The Squad server license can be changed by editing ${selfname}." echo -e "" diff --git a/lgsm/modules/install_stats.sh b/lgsm/modules/install_stats.sh index c3e92323d..40a13434d 100644 --- a/lgsm/modules/install_stats.sh +++ b/lgsm/modules/install_stats.sh @@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "${bold}${lightyellow}LinuxGSM Stats${default}" fn_messages_separator -fn_sleep_time echo -e "Assist LinuxGSM development by sending anonymous stats to developers." echo -e "Collected data is publicly available: ${italic}https://linuxgsm.com/data/usage${default}" echo -e "More info: ${italic}https://docs.linuxgsm.com/configuration/linuxgsm-stats${default}" diff --git a/lgsm/modules/install_ts3db.sh b/lgsm/modules/install_ts3db.sh index e5776c30f..464bd686a 100644 --- a/lgsm/modules/install_ts3db.sh +++ b/lgsm/modules/install_ts3db.sh @@ -45,7 +45,7 @@ fn_install_ts3db_mariadb() { sed -i "s/dbpluginparameter=/dbpluginparameter=ts3db_mariadb.ini/g" "${servercfgfullpath}" sed -i "s/dbsqlcreatepath=create_sqlite\//dbsqlcreatepath=create_mariadb\//g" "${servercfgfullpath}" echo -e "updating ts3db_mariadb.ini." - fn_sleep_time + fn_sleep_time_1 } echo -e "" @@ -69,5 +69,5 @@ fn_print_information_nl "Key also saved in:" echo -e "${serverfiles}/privilege_key.txt" cd "${executabledir}" || exit ./ts3server_startscript.sh start inifile=ts3-server.ini 2>&1 | tee "${serverfiles}/privilege_key.txt" -sleep 5 +fn_sleep_time_5 ./ts3server_startscript.sh stop diff --git a/lgsm/modules/update_fctr.sh b/lgsm/modules/update_fctr.sh index 2eef0d4cd..8fb78ede3 100644 --- a/lgsm/modules/update_fctr.sh +++ b/lgsm/modules/update_fctr.sh @@ -104,7 +104,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_jk2.sh b/lgsm/modules/update_jk2.sh index f685fd4cb..e2715c01c 100644 --- a/lgsm/modules/update_jk2.sh +++ b/lgsm/modules/update_jk2.sh @@ -100,7 +100,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_mc.sh b/lgsm/modules/update_mc.sh index c4aa1b425..4a0bdde37 100644 --- a/lgsm/modules/update_mc.sh +++ b/lgsm/modules/update_mc.sh @@ -116,7 +116,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_mcb.sh b/lgsm/modules/update_mcb.sh index eb8adfd12..7bd273d66 100644 --- a/lgsm/modules/update_mcb.sh +++ b/lgsm/modules/update_mcb.sh @@ -122,7 +122,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_mta.sh b/lgsm/modules/update_mta.sh index cd1195563..c6f7dfcb0 100644 --- a/lgsm/modules/update_mta.sh +++ b/lgsm/modules/update_mta.sh @@ -108,7 +108,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_pmc.sh b/lgsm/modules/update_pmc.sh index 9bfa82101..5d44bee21 100644 --- a/lgsm/modules/update_pmc.sh +++ b/lgsm/modules/update_pmc.sh @@ -126,7 +126,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_ts3.sh b/lgsm/modules/update_ts3.sh index c00ae75cb..1fa77f428 100644 --- a/lgsm/modules/update_ts3.sh +++ b/lgsm/modules/update_ts3.sh @@ -108,7 +108,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_ut99.sh b/lgsm/modules/update_ut99.sh index bdd3631f3..6d0be1941 100644 --- a/lgsm/modules/update_ut99.sh +++ b/lgsm/modules/update_ut99.sh @@ -102,7 +102,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_vints.sh b/lgsm/modules/update_vints.sh index b38372058..403917e0c 100644 --- a/lgsm/modules/update_vints.sh +++ b/lgsm/modules/update_vints.sh @@ -109,7 +109,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/linuxgsm.sh b/linuxgsm.sh index 520373d48..20adc1db6 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -323,17 +323,18 @@ fn_install_file() { # Prevent LinuxGSM from running as root. Except if doing a dependency install. if [ "$(whoami)" == "root" ]; then - if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then - if [ "${shortname}" == "core" ]; then - echo -e "[ FAIL ] Do NOT run this script as root!" - exit 1 + if [ -f "${modulesdir}/core_modules.sh" ] || [ -f "${modulesdir}/check_root.sh" ] || [ -f "${modulesdir}/core_messages.sh" ]; then + if [ "${userinput}" != "install" ] && [ "${userinput}" != "auto-install" ] && [ "${userinput}" != "i" ] && [ "${userinput}" != "ai" ]; then + core_modules.sh + core_messages.sh + fn_ansi_loader + check_root.sh fi - elif [ ! -f "${modulesdir}/core_modules.sh" ] || [ ! -f "${modulesdir}/check_root.sh" ] || [ ! -f "${modulesdir}/core_messages.sh" ]; then - echo -e "[ FAIL ] Do NOT run this script as root!" - exit 1 else - core_modules.sh - check_root.sh + if [ "${userinput}" != "install" ] && [ "${userinput}" != "auto-install" ] && [ "${userinput}" != "i" ] && [ "${userinput}" != "ai" ]; then + echo -e "[ FAIL ] Do NOT run as root!" + exit 1 + fi fi fi