@@ -113,6 +113,8 @@ load_default_config() {
113113 CONFIG_mail_address=' root'
114114 CONFIG_encrypt=' no'
115115 CONFIG_encrypt_password=' password0123'
116+ CONFIG_gpg_encrypt=' no'
117+ CONFIG_gpg_encrypt_recipient=' SHORT_ID'
116118}
117119
118120mysql_commands () {
@@ -365,6 +367,27 @@ files_postprocessing () {
365367 }
366368 # <- CONFIG_encrypt
367369
370+ # -> CONFIG_gpg_encrypt
371+ [[ " ${CONFIG_gpg_encrypt} " = " yes" && " ${CONFIG_gpg_encrypt_recipient} " ]] && {
372+ if (( $CONFIG_dryrun )) ; then
373+ printf ' dry-running: gpg --encrypt --recipient ${CONFIG_gpg_encrypt_recipient} --output ${1}.gpg --batch ${1}'
374+ else
375+ gpg --encrypt --recipient ${CONFIG_gpg_encrypt_recipient} --output ${1} .gpg --batch ${1}
376+ if (( $? == 0 )) ; then
377+ if rm ${1} 2>&1 ; then
378+ echo " Successfully encrypted archive as ${1} .gpg"
379+ let " flags |= $flags_files_postprocessing_success_encrypt "
380+ else
381+ echo " Successfully encrypted archive as ${1} .gpg, but could not remove cleartext file ${1} ."
382+ let " E |= $E_enc_cleartext_delfailed "
383+ fi
384+ else
385+ let " E |= $E_enc_failed "
386+ fi
387+ fi
388+ }
389+ # <- CONFIG_gpg_encrypt
390+
368391 # -> CONFIG_mysql_dump_latest
369392 [[ " ${CONFIG_mysql_dump_latest} " = " yes" ]] && {
370393 if (( $flags & $flags_files_postprocessing_success_encrypt )) ; then
@@ -781,7 +804,7 @@ process_dbs() {
781804 db=" $1 "
782805 fi
783806
784- if [[ " x$CONFIG_mysql_dump_differential " = " xyes" ]] && [[ " x${CONFIG_encrypt} " != " xyes" ]] && (( $activate_differential_backup )) ; then
807+ if [[ " x$CONFIG_mysql_dump_differential " = " xyes" ]] && [[ " x${CONFIG_encrypt} " != " xyes" ]] && [[ " x ${CONFIG_gpg_encrypt} " != " xyes " ]] && (( $activate_differential_backup )) ; then
785808
786809
787810 unset manifest_entry manifest_entry_to_check
@@ -835,7 +858,7 @@ process_dbs() {
835858
836859 fi
837860
838- if [[ " x$CONFIG_mysql_dump_differential " = " xyes" ]] && [[ " x${CONFIG_encrypt} " != " xyes" ]] && (( $activate_differential_backup )) && (( ! ($filename_flags & $filename_flag_encrypted ) )) ; then
861+ 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
839862
840863 # the master file is encrypted ... well this just shouldn't happen ^^ not going to decrypt or stuff like that ...at least not today :)
841864
0 commit comments