1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2026-03-02 03:49:29 +00:00

Support yadm.gpg-recipient = ASK

This commit is contained in:
Tim Byrne
2016-04-21 07:59:43 -05:00
parent 5ad5b2df7e
commit ea3b2ecfa8
4 changed files with 33 additions and 17 deletions

10
yadm
View File

@@ -228,10 +228,12 @@ function encrypt() {
#; Build gpg options for gpg
GPG_KEY="$(config yadm.gpg-recipient)"
if [ "$GPG_KEY" != "" ]; then
GPG_OPTS="-er $GPG_KEY"
if [ "$GPG_KEY" = "ASK" ]; then
GPG_OPTS=("--no-default-recipient" "-e")
elif [ "$GPG_KEY" != "" ]; then
GPG_OPTS=("-e" "-r $GPG_KEY")
else
GPG_OPTS="-c"
GPG_OPTS=("-c")
fi
#; build a list of globs from YADM_ENCRYPT
@@ -243,7 +245,7 @@ function encrypt() {
done < "$YADM_ENCRYPT"
#; encrypt all files which match the globs
tar -cv "${GLOBS[@]}" | gpg --yes "$GPG_OPTS" --output "$YADM_ARCHIVE"
tar -cv "${GLOBS[@]}" | gpg --yes "${GPG_OPTS[@]}" --output "$YADM_ARCHIVE"
if [ $? = 0 ]; then
echo "Wrote new file: $YADM_ARCHIVE"
else