Skip to content

Commit e50a8cb

Browse files
authored
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.
1 parent 7453852 commit e50a8cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

install/assets/functions/10-db-backup

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,11 @@ post_dbbackup() {
644644
### Post Script Support
645645
if [ -n "${POST_SCRIPT}" ] ; then
646646
if var_true "${POST_SCRIPT_SKIP_X_VERIFY}" ; then
647-
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
647+
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${filesize}" "${checksum_value}"
648648
else
649649
if [ -x "${POST_SCRIPT}" ] ; then
650650
print_notice "Found POST_SCRIPT environment variable. Executing '${POST_SCRIPT}"
651-
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
651+
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${filesize}" "${checksum_value}"
652652
else
653653
print_error "Can't execute POST_SCRIPT environment variable '${POST_SCRIPT}' as its filesystem bit is not executible!"
654654
fi
@@ -659,12 +659,12 @@ post_dbbackup() {
659659
if [ -d "/assets/custom-scripts/" ] ; then
660660
for f in $(find /assets/custom-scripts/ -name \*.sh -type f); do
661661
if var_true "${POST_SCRIPT_SKIP_X_VERIFY}" ; then
662-
${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
662+
${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${filesize}" "${checksum_value}"
663663
else
664664
if [ -x "${f}" ] ; then
665665
print_notice "Executing post backup custom script : '${f}'"
666666
## script EXIT_CODE DB_TYPE DB_HOST DB_NAME STARTEPOCH FINISHEPOCH DURATIONEPOCH BACKUP_FILENAME FILESIZE CHECKSUMVALUE
667-
${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
667+
${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${filesize}" "${checksum_value}"
668668
else
669669
print_error "Can't run post backup custom script: '${f}' as its filesystem bit is not executible!"
670670
fi

0 commit comments

Comments
 (0)