Correction : {host,local,remote}/ : duplicity + MySQL.
[lhc/ateliers.git] / remote / duplicity-key-send
index 650e219..52ff14a 100755 (executable)
@@ -2,6 +2,18 @@
 tool=$(readlink -e "${0%/*}/..")
 . "$tool"/remote/lib.sh
 
-gpg --export-options export-reset-subkey-passwd \
+PATH=/usr/lib/gnupg2:"$PATH"
+
+IFS= read -r pass <<-EOF
+       $(gpg --decrypt "$tool"/var/sec/openpgp/backup+"$local_hostname"@"$local_domainname".pass.gpg)
+       EOF
+for fpr in $(remote/gpg --list-secret-keys --with-colons --with-fingerprint --with-fingerprint \
+ -- "backup+$local_hostname@$local_domainname" | grep '^fpr:' | cut -d : -f 10)
+ do gpg-preset-passphrase --preset -v $fpr <<-EOF
+       $pass
+       EOF
+ done
+
+"$tool"/remote/gpg --export-options export-reset-subkey-passwd \
  --export-secret-subkeys "backup+$local_hostname@$local_domainname" |
-"$tool"/remote/ssh gpg --import -
+"$tool"/remote/ssh backup@$local_fqdn gpg --import -