summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/keyringer/recrypt14
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