From e50a8cb0ece06f957466421e4d1975cfef275f16 Mon Sep 17 00:00:00 2001 From: Arif Er <46054733+arifer612@users.noreply.github.com> Date: Mon, 15 Aug 2022 21:51:40 +0800 Subject: [PATCH] fix: correct case for filesize variable Post script support expects a value from a declared variable `$FILESIZE` to provide the size of the backup files. Such a variable does not exist, leading to a situation where using `"${9}"` in a custom script furnishes the checksum hash. However, earlier up in the script the file size of the backup is indeed assigned to a variable, only that is it completely in lower case: `$filesize`. This commit aims to fix that inconsistency. --- install/assets/functions/10-db-backup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/assets/functions/10-db-backup b/install/assets/functions/10-db-backup index ed3b84e..cf6f70c 100755 --- a/install/assets/functions/10-db-backup +++ b/install/assets/functions/10-db-backup @@ -644,11 +644,11 @@ post_dbbackup() { ### Post Script Support if [ -n "${POST_SCRIPT}" ] ; then if var_true "${POST_SCRIPT_SKIP_X_VERIFY}" ; then - eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}" + eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${filesize}" "${checksum_value}" else if [ -x "${POST_SCRIPT}" ] ; then print_notice "Found POST_SCRIPT environment variable. Executing '${POST_SCRIPT}" - eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}" + eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${filesize}" "${checksum_value}" else print_error "Can't execute POST_SCRIPT environment variable '${POST_SCRIPT}' as its filesystem bit is not executible!" fi @@ -659,12 +659,12 @@ post_dbbackup() { if [ -d "/assets/custom-scripts/" ] ; then for f in $(find /assets/custom-scripts/ -name \*.sh -type f); do if var_true "${POST_SCRIPT_SKIP_X_VERIFY}" ; then - ${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}" + ${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${filesize}" "${checksum_value}" else if [ -x "${f}" ] ; then print_notice "Executing post backup custom script : '${f}'" ## script EXIT_CODE DB_TYPE DB_HOST DB_NAME STARTEPOCH FINISHEPOCH DURATIONEPOCH BACKUP_FILENAME FILESIZE CHECKSUMVALUE - ${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}" + ${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${filesize}" "${checksum_value}" else print_error "Can't run post backup custom script: '${f}' as its filesystem bit is not executible!" fi