@@ -110,6 +110,8 @@ load_default_config() {
110110 CONFIG_mail_address=' root'
111111 CONFIG_encrypt=' no'
112112 CONFIG_encrypt_password=' password0123'
113+ CONFIG_gpg_encrypt=' no'
114+ CONFIG_gpg_encrypt_recipient=' SHORT_ID'
113115}
114116
115117mysql_commands () {
@@ -346,6 +348,27 @@ files_postprocessing () {
346348 }
347349 # <- CONFIG_encrypt
348350
351+ # -> CONFIG_gpg_encrypt
352+ [[ " ${CONFIG_gpg_encrypt} " = " yes" && " ${CONFIG_gpg_encrypt_recipient} " ]] && {
353+ if (( $CONFIG_dryrun )) ; then
354+ printf ' dry-running: gpg --encrypt --recipient ${CONFIG_gpg_encrypt_recipient} --output ${1}.gpg --batch ${1}'
355+ else
356+ gpg --encrypt --recipient ${CONFIG_gpg_encrypt_recipient} --output ${1} .gpg --batch ${1}
357+ if (( $? == 0 )) ; then
358+ if rm ${1} 2>&1 ; then
359+ echo " Successfully encrypted archive as ${1} .gpg"
360+ let " flags |= $flags_files_postprocessing_success_encrypt "
361+ else
362+ echo " Successfully encrypted archive as ${1} .gpg, but could not remove cleartext file ${1} ."
363+ let " E |= $E_enc_cleartext_delfailed "
364+ fi
365+ else
366+ let " E |= $E_enc_failed "
367+ fi
368+ fi
369+ }
370+ # <- CONFIG_gpg_encrypt
371+
349372 # -> CONFIG_mysql_dump_latest
350373 [[ " ${CONFIG_mysql_dump_latest} " = " yes" ]] && {
351374 if (( $flags & $flags_files_postprocessing_success_encrypt )) ; then
@@ -732,7 +755,7 @@ process_dbs() {
732755 db=" $1 "
733756 fi
734757
735- if [[ " x$CONFIG_mysql_dump_differential " = " xyes" ]] && [[ " x${CONFIG_encrypt} " != " xyes" ]] && (( $activate_differential_backup )) ; then
758+ if [[ " x$CONFIG_mysql_dump_differential " = " xyes" ]] && [[ " x${CONFIG_encrypt} " != " xyes" ]] && [[ " x ${CONFIG_gpg_encrypt} " != " xyes " ]] && (( $activate_differential_backup )) ; then
736759
737760
738761 unset manifest_entry manifest_entry_to_check
@@ -784,7 +807,7 @@ process_dbs() {
784807
785808 fi
786809
787- if [[ " x$CONFIG_mysql_dump_differential " = " xyes" ]] && [[ " x${CONFIG_encrypt} " != " xyes" ]] && (( $activate_differential_backup )) && (( ! ($filename_flags & $filename_flag_encrypted ) )) ; then
810+ if [[ " x$CONFIG_mysql_dump_differential " = " xyes" ]] && [[ " x${CONFIG_encrypt} " != " xyes" ]] && [[ " x ${CONFIG_gpg_encrypt} " != " xyes " ]] && (( $activate_differential_backup )) && (( ! ($filename_flags & $filename_flag_encrypted ) )) ; then
788811
789812 # the master file is encrypted ... well this just shouldn't happen ^^ not going to decrypt or stuff like that ...at least not today :)
790813
0 commit comments