Skip to content

Commit

Permalink
Merge pull request yadm-dev#8 from esphen/master
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLocehiliosan committed Apr 21, 2016
2 parents 7854275 + 33c8cd8 commit fbaf5b6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
10 changes: 9 additions & 1 deletion yadm
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ function encrypt() {
return
}

#; Build gpg options for gpg
GPG_KEY="$(config yadm.gpg-recipient)"
if [ "$GPG_KEY" != "" ]; then
GPG_OPTS="-er $GPG_KEY"
else
GPG_OPTS="-c"
fi

#; build a list of globs from YADM_ENCRYPT
GLOBS=()
while IFS='' read -r glob || [ -n "$glob" ]; do
Expand All @@ -235,7 +243,7 @@ function encrypt() {
done < "$YADM_ENCRYPT"

#; encrypt all files which match the globs
tar -cv "${GLOBS[@]}" | gpg --yes -c --output "$YADM_ARCHIVE"
tar -cv ${GLOBS[@]} | gpg --yes "$GPG_OPTS" --output "$YADM_ARCHIVE"
if [ $? = 0 ]; then
echo "Wrote new file: $YADM_ARCHIVE"
else
Expand Down
6 changes: 6 additions & 0 deletions yadm.1
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ This feature is enabled by default.
Disable the permission changes to
.IR $HOME/.gnupg/* .
This feature is enabled by default.
.TP
.B yadm.gpg-recipient
Asymmetrically encrypt files with a gpg public/private key pair.
Provide a key ID to encrypt against that public key.
If left blank or not provided, symmetric encryption is used instead.
This feature is disabled by deafult.
.SH ALTERNATES
When managing a set of files across different systems, it can be useful to have
an automated way of choosing an alternate version of a file for a different
Expand Down
6 changes: 6 additions & 0 deletions yadm.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@
Disable the permission changes to $HOME/.gnupg/*. This feature
is enabled by default.

yadm.gpg-recipient
Asymmetrically encrypt files with a gpg public/private key pair.
Provice a key ID to encrypt against that public key.
If left blank or not provided, symmetric encryption is used
instead. This feature is disabled by deafult.

## ALTERNATES
When managing a set of files across different systems, it can be useful
to have an automated way of choosing an alternate version of a file for
Expand Down

0 comments on commit fbaf5b6

Please sign in to comment.