Skip to content

Commit

Permalink
backup-mysql: allow configuring passphrase file, fix non-interactive …
Browse files Browse the repository at this point in the history
…support
  • Loading branch information
FooBarWidget committed Jun 22, 2023
1 parent 548b6ec commit cc8ea49
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backup-mysql
Expand Up @@ -6,7 +6,11 @@ MAX_BACKUPS = optional_config('max-backups', 10)
if enc = optional_config(:encrypt) if enc = optional_config(:encrypt)
abort "*** ERROR: please set the configuration option backup-mysql.encrypt.key" if !enc['key'] abort "*** ERROR: please set the configuration option backup-mysql.encrypt.key" if !enc['key']
abort "*** ERROR: please set the configuration option backup-mysql.encrypt.recipients" if !enc['recipients'] || enc['recipients'].empty? abort "*** ERROR: please set the configuration option backup-mysql.encrypt.recipients" if !enc['recipients'] || enc['recipients'].empty?
encrypt_command = "gpg --sign --encrypt -u '#{enc['key']}'" encrypt_command = "gpg --batch --pinentry-mode loopback --sign --encrypt"
if path = enc['passphrase_file']
encrypt_command << " --passphrase-file #{Shellwords.escape path}"
end
encrypt_command << " -u '#{enc['key']}'"
enc['recipients'].each do |recipient| enc['recipients'].each do |recipient|
encrypt_command << " --recipient '#{recipient}'" encrypt_command << " --recipient '#{recipient}'"
end end
Expand Down

0 comments on commit cc8ea49

Please sign in to comment.