diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-09-30 18:26:48 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-09-30 18:28:28 +0200 |
commit | 3b16d1d3fbd221724378475085a1170997d732b5 (patch) | |
tree | 9f7cb616acabbf31f4ac97ef8718cb5a3352c01f /src | |
parent | ec5eeec7445fe3d662ddd8e1df573931b9bb312c (diff) |
Explicitly use gpg2 rather than relying on symlink.
Diffstat (limited to 'src')
-rwxr-xr-x | src/password-store.sh | 19 | ||||
-rw-r--r-- | src/platform/darwin.sh | 1 | ||||
-rw-r--r-- | src/platform/freebsd.sh | 1 |
3 files changed, 9 insertions, 12 deletions
diff --git a/src/password-store.sh b/src/password-store.sh index 503bac4..e4e622e 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -119,7 +119,6 @@ tmpdir() { fi } -GPG="gpg" GETOPT="getopt" # source /path/to/platform-defined-functions @@ -160,7 +159,7 @@ case "$command" in if [[ $reencrypt -eq 1 ]]; then find "$PREFIX" -iname '*.gpg' | while read passfile; do - $GPG -d $GPG_OPTS "$passfile" | $GPG -e -r "$gpg_id" -o "$passfile.new" $GPG_OPTS && + gpg2 -d $GPG_OPTS "$passfile" | gpg2 -e -r "$gpg_id" -o "$passfile.new" $GPG_OPTS && mv -v "$passfile.new" "$passfile" done git_add_file "$PREFIX" "Reencrypted entire store using new GPG id $gpg_id." @@ -222,9 +221,9 @@ case "$command" in exit 1 fi if [[ $clip -eq 0 ]]; then - exec $GPG -d $GPG_OPTS "$passfile" + exec gpg2 -d $GPG_OPTS "$passfile" else - clip "$($GPG -d $GPG_OPTS "$passfile" | head -n 1)" "$path" + clip "$(gpg2 -d $GPG_OPTS "$passfile" | head -n 1)" "$path" fi fi ;; @@ -257,7 +256,7 @@ case "$command" in if [[ $multiline -eq 1 ]]; then echo "Enter contents of $path and press Ctrl+D when finished:" echo - $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS + gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS elif [[ $noecho -eq 1 ]]; then while true; do read -p "Enter password for $path: " -s password @@ -265,7 +264,7 @@ case "$command" in read -p "Retype password for $path: " -s password_again echo if [[ $password == $password_again ]]; then - $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password" + gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password" break else echo "Error: the entered passwords do not match." @@ -273,7 +272,7 @@ case "$command" in done else read -p "Enter password for $path: " -e password - $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password" + gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password" fi git_add_file "$passfile" "Added given password for $path to store." ;; @@ -295,11 +294,11 @@ case "$command" in action="Added" if [[ -f $passfile ]]; then - $GPG -d -o "$tmp_file" $GPG_OPTS "$passfile" || exit 1 + gpg2 -d -o "$tmp_file" $GPG_OPTS "$passfile" || exit 1 action="Edited" fi ${EDITOR:-vi} "$tmp_file" - while ! $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS "$tmp_file"; do + while ! gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS "$tmp_file"; do echo "GPG encryption failed. Retrying." sleep 1 done @@ -337,7 +336,7 @@ case "$command" in pass="$(pwgen -s $symbols $length 1)" [[ -n $pass ]] || exit 1 - $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass" + gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass" git_add_file "$passfile" "Added generated password for $path to store." if [[ $clip -eq 0 ]]; then diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh index fca2f91..4e94941 100644 --- a/src/platform/darwin.sh +++ b/src/platform/darwin.sh @@ -31,5 +31,4 @@ tmpdir() { mount -t hfs -o noatime -o nobrowse "$ramdisk_dev" "$tmp_dir" || exit 1 } -GPG="gpg2" GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || echo /usr/local)/bin/getopt" diff --git a/src/platform/freebsd.sh b/src/platform/freebsd.sh index ff41379..a8611e8 100644 --- a/src/platform/freebsd.sh +++ b/src/platform/freebsd.sh @@ -15,5 +15,4 @@ tmpdir() { fi } -GPG="gpg2" GETOPT="/usr/local/bin/getopt" |