Browse Source

chore: flipping exit code if statements

Must have consistancy XD
pull/4146/head
Daniel Gibbs 3 years ago
parent
commit
1bcc7f4821
  1. 11
      lgsm/functions/command_backup.sh
  2. 14
      lgsm/functions/core_dl.sh
  3. 2
      lgsm/functions/core_exit.sh
  4. 6
      lgsm/functions/info_game.sh
  5. 8
      lgsm/functions/install_ts3db.sh

11
lgsm/functions/command_backup.sh

@ -99,16 +99,17 @@ fn_backup_migrate_olddir() {
fn_script_log_info "${rootdir}/backups > ${backupdir}"
mv "${rootdir}/backups/"* "${backupdir}" 2> /dev/null
exitcode=$?
if [ "${exitcode}" -eq 0 ]; then
if [ "${exitcode}" == 0 ]; then
rmdir "${rootdir}/backups" 2> /dev/null
exitcode=$?
fi
if [ "${exitcode}" -eq 0 ]; then
fn_print_ok_nl "Backup directory is being migrated"
fn_script_log_pass "Backup directory is being migrated"
else
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

14
lgsm/functions/core_dl.sh

@ -124,7 +124,7 @@ fn_dl_steamcmd() {
echo -en "Please provide content log to LinuxGSM developers https://linuxgsm.com/steamcmd-error"
fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured"
fi
elif [ "${exitcode}" != "0" ]; then
elif [ "${exitcode}" != 0 ]; then
fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}"
fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}"
else
@ -146,12 +146,12 @@ fn_clear_tmp() {
if [ -d "${tmpdir}" ]; then
rm -rf "${tmpdir:?}/"*
local exitcode=$?
if [ "${exitcode}" == 0 ]; then
fn_print_ok_eol_nl
fn_script_log_pass "clearing LinuxGSM tmp directory"
else
if [ "${exitcode}" != 0 ]; then
fn_print_error_eol_nl
fn_script_log_error "clearing LinuxGSM tmp directory"
else
fn_print_ok_eol_nl
fn_script_log_pass "clearing LinuxGSM tmp directory"
fi
fi
}
@ -226,7 +226,7 @@ fn_dl_extract() {
local exitcode=$?
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Extracting download"
fn_script_log_fatal "Extracting ${local_filename}"
if [ -f "${lgsmlog}" ]; then
echo -e "${extractcmd}" >> "${lgsmlog}"
fi
@ -234,7 +234,7 @@ fn_dl_extract() {
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "Extracting download"
fn_script_log_pass "Extracting ${local_filename}"
fi
}

2
lgsm/functions/core_exit.sh

@ -25,7 +25,7 @@ fi
if [ "${exitbypass}" ]; then
unset exitbypass
elif [ "${exitcode}" ] && [ "${exitcode}" != "0" ]; then
elif [ "${exitcode}" != "0" ]; then
# List LinuxGSM version in logs
fn_script_log_info "LinuxGSM version: ${version}"
if [ "${exitcode}" == "1" ]; then

6
lgsm/functions/info_game.sh

@ -2551,10 +2551,10 @@ if [ ! -f "${tmpdir}/extip.txt" ]; then
extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2> /dev/null)"
exitcode=$?
# if curl passes add extip to externalip.txt
if [ "${exitcode}" == "0" ]; then
echo "${extip}" > "${tmpdir}/extip.txt"
else
if [ "${exitcode}" != "0" ]; then
echo "Unable to get external IP address"
else
echo "${extip}" > "${tmpdir}/extip.txt"
fi
else
extip="$(cat "${tmpdir}/extip.txt")"

8
lgsm/functions/install_ts3db.sh

@ -12,13 +12,13 @@ fn_install_ts3db_mariadb() {
echo -e "copying libmariadb.so.2...\c"
cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}"
local exitcode=$?
if [ "${exitcode}" == "0" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "copying libmariadb.so.2"
else
if [ "${exitcode}" != "0" ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "copying libmariadb.so.2"
core_exit.sh
else
fn_print_ok_eol_nl
fn_script_log_pass "copying libmariadb.so.2"
fi
fi

Loading…
Cancel
Save