X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=blobdiff_plain;f=remote%2Fduplicity;fp=remote%2Fduplicity;h=621dc2d2965528d7987eae1408751407b657f1ea;hp=0000000000000000000000000000000000000000;hb=7ec5ddab73855d65555a21873ccf8d2653a22ee6;hpb=344f65c397f046293ed2e5aa2b9dcd49337bdd71 diff --git a/remote/duplicity b/remote/duplicity new file mode 100755 index 0000000..621dc2d --- /dev/null +++ b/remote/duplicity @@ -0,0 +1,33 @@ +#!/bin/sh -eu +# SYNTAX: $duplicity_options +# DESCRIPTION: encapsuleur de duplicity(1) préchargeant sa clef OpenPGP. +tool=$(readlink -e "${0%/*}/..") +. "$tool"/remote/lib.sh + +uid=backup+"$local_hostname"@"$local_domainname" +trap_exit () { + errno=$? + "$tool"/remote/gpg-preset-passphrase --forget "$uid" + exit $errno + } +trap trap_exit EXIT +"$tool"/remote/gpg-preset-passphrase --preset "$uid" + +while IFS=: read -r type trust size algo keyid date x x x x x cap x + do case $type,$cap in + (sub,e) encrypt_key=${keyid#????????};; + (sub,s) sign_key=$keyid;; + esac done <<-EOF + $("$tool"/remote/gpg --list-public-keys --with-colons -- "$uid") + EOF + +/usr/bin/duplicity \ + --archive-dir "$tool"/var/backup/current/archive \ + --gpg-options --homedir="$tool"/var/pub/openpgp \ + --gpg-options --trusted-key="$sign_key" \ + --gpg-options --no-permission-warning \ + --encrypt-key "$encrypt_key" \ + --sign-key "${sign_key#????????}" \ + --use-agent \ + -vw ${TRACE:+--verbosity info} \ + "$@"