pash: don't overwrite GPG_TTY if set

This commit is contained in:
Dylan Araps 2019-11-26 21:19:22 +00:00
parent b52122a071
commit f163bb91ed
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 3 additions and 1 deletions

4
pash
View File

@ -44,7 +44,7 @@ pw_add() {
# Use 'gpg' to store the password in an encrypted file. The
# 'GPG_TTY' environment variable is set to workaround cases
# where 'gpg' cannot find an attached terminal.
echo "$pass" | GPG_TTY=$(tty) "$gpg" "$@" -o "$name.gpg" &&
echo "$pass" | "$gpg" "$@" -o "$name.gpg" &&
printf '%s\n' "Saved '$name' to the store."
}
@ -176,6 +176,8 @@ main() {
glob "$2" '*/*' && { mkdir -p "${2%/*}" ||
die "Couldn't create category '${2%/*}'."; }
export GPG_TTY=${GPG_TTY:-$(tty)}
umask 077
case $1 in