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 $("$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 gpg --import -
+"$tool"/remote/ssh backup@$local_fqdn gpg --import -