diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-03-18 18:04:38 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-03-18 18:04:38 -0300 |
commit | 7423fcdcbbe586d2e6b6b675dbaff8a7a7bf7d0f (patch) | |
tree | 2b9a67856d7dcac03bb0891cde8a2565f485ddb9 /share | |
parent | 4153129f3ae06a7dca7085e05e278232bbb81d32 (diff) | |
download | keyringer-7423fcdcbbe586d2e6b6b675dbaff8a7a7bf7d0f.tar.gz keyringer-7423fcdcbbe586d2e6b6b675dbaff8a7a7bf7d0f.tar.bz2 |
Pipefail approach (#6)
Diffstat (limited to 'share')
-rwxr-xr-x | share/keyringer/recrypt | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/share/keyringer/recrypt b/share/keyringer/recrypt index fc16603..695e789 100755 --- a/share/keyringer/recrypt +++ b/share/keyringer/recrypt @@ -14,18 +14,12 @@ function keyringer_recrypt { # Set recipients file keyringer_set_recipients "$FILE" - # Test decryption - $GPG --use-agent -d "$KEYDIR/$FILE" > /dev/null - - err="$?" - - if [ "$err" != "0" ]; then - echo "$BASENAME: decryption failed. Can't recrypt." - exit "$err" - fi + # Set pipefail so we can detect decryption failures + set -o pipefail # Recrypt - $GPG --use-agent -d "$KEYDIR/$FILE" | $GPG --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") > "$KEYDIR/$FILE" + $GPG --use-agent -d "$KEYDIR/$FILE" | \ + $GPG --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") > "$KEYDIR/$FILE" if [ "$?" != "0" ]; then exit 1 |