Browse Source

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.
pull/4339/head
Daniel Gibbs 2 years ago
parent
commit
e921e8c8fe
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 14
      lgsm/modules/check_glibc.sh
  2. 5
      lgsm/modules/check_permissions.sh
  3. 4
      lgsm/modules/check_system_requirements.sh
  4. 10
      lgsm/modules/command_backup.sh

14
lgsm/modules/check_glibc.sh

@ -13,19 +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_print_information_nl "Distro upgrade is required"
fn_script_log_info "Distro upgrade is required"
fn_sleep_time_5
fi

5
lgsm/modules/check_permissions.sh

@ -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

4
lgsm/modules/check_system_requirements.sh

@ -46,9 +46,9 @@ 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_5
fi

10
lgsm/modules/command_backup.sh

@ -56,12 +56,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

Loading…
Cancel
Save