X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=blobdiff_plain;f=remote%2Fduplicity-key-send;h=c576ec9aec82927bb80da0a12285515b31c19899;hp=0580e1bbba5ca8c551ecc642a603a0ebd8c2c9f8;hb=6647e7fb851e2dbe5a5c7ec60358f7371bf17183;hpb=3ad6118386977e346d81042e924e5db9c5f15b7d diff --git a/remote/duplicity-key-send b/remote/duplicity-key-send index 0580e1b..c576ec9 100755 --- a/remote/duplicity-key-send +++ b/remote/duplicity-key-send @@ -2,6 +2,18 @@ tool=$(readlink -e "${0%/*}/..") . "$tool"/remote/lib.sh -gpg --export-options export-reset-subkey-passwd \ - --export-secret-subkeys "backup+$vm_hostname@$vm_domainname" | -"$tool"/remote/ssh gpg --import - +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 $("$tool"/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 backup@$local_fqdn gpg --import -