From 9767b9d4f828284b8cd5a18617e676f40c86a2c6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 25 Feb 2019 01:08:50 +0200 Subject: [PATCH] add support for both gpg and gpg2 --- pash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pash b/pash index 89fc8c4..1ec04c8 100755 --- a/pash +++ b/pash @@ -23,7 +23,7 @@ pw_add() { mkdir -p "${1%/*}" || die "Couldn't create category '${1%/*}'." } - gpg2 -co "$1.gpg" <<< "$password" + "${gpg[0]}" -co "$1.gpg" <<< "$password" } pw_del() { @@ -34,7 +34,7 @@ pw_del() { } pw_show() { - read -r password < <(gpg2 -dq "$1.gpg" || + read -r password < <("${gpg[0]}" -dq "$1.gpg" || die "Failed to decrypt '$1'." ) } @@ -125,7 +125,7 @@ get_args() { main() { get_args "$@" - hash gpg2 2>/dev/null || + mapfile -t gpg < <(type -p gdg gpg2) && [[ ! -x ${gpg[0]} ]] && die "GPG not found." [[ -r /dev/urandom ]] ||