diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-06 21:14:25 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-06 21:14:25 +0100 |
commit | 4b0b6ac82f0c372405cadd921c9d5a1d9927788f (patch) | |
tree | 12d74fbbf4208a6a1b398bf6abbb6554bd12a4ef | |
parent | 1177ab5f063c8d9ec45f1c324d687cdaa5167be2 (diff) |
Make gpg errors fatal
-rwxr-xr-x | src/password-store.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/password-store.sh b/src/password-store.sh index a28b128..63be840 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -380,7 +380,7 @@ cmd_insert() { if [[ $multiline -eq 1 ]]; then echo "Enter contents of $path and press Ctrl+D when finished:" echo - $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" || exit 1 + $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" || die "Password encryption aborted." elif [[ $noecho -eq 1 ]]; then local password password_again while true; do @@ -389,16 +389,16 @@ cmd_insert() { read -r -p "Retype password for $path: " -s password_again || exit 1 echo if [[ $password == "$password_again" ]]; then - $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" <<<"$password" + $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" <<<"$password" || die "Password encryption aborted." break else - echo "Error: the entered passwords do not match." + die "Error: the entered passwords do not match." fi done else local password read -r -p "Enter password for $path: " -e password - $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" <<<"$password" + $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" <<<"$password" || die "Password encryption aborted." fi git_add_file "$passfile" "Add given password for $path to store." } @@ -457,7 +457,7 @@ cmd_generate() { local pass="$(pwgen -s $symbols $length 1)" [[ -n $pass ]] || exit 1 if [[ $inplace -eq 0 ]]; then - $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" <<<"$pass" + $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" <<<"$pass" || die "Password encryption aborted." else local passfile_temp="${passfile}.tmp.${RANDOM}.${RANDOM}.${RANDOM}.${RANDOM}.--" if $GPG -d "${GPG_OPTS[@]}" "$passfile" | sed $'1c \\\n'"$(sed 's/[\/&]/\\&/g' <<<"$pass")"$'\n' | $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile_temp" "${GPG_OPTS[@]}"; then |