From c561d85cdbf2b94b1e45f2d58d1f341442038621 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Mon, 21 Sep 2020 11:24:56 -0400 Subject: cryptonomic gpg: set GNUPGHOME --- selfpublish.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/selfpublish.sh b/selfpublish.sh index c11eb8f..6ebf36b 100644 --- a/selfpublish.sh +++ b/selfpublish.sh @@ -187,6 +187,11 @@ verbose() "$@" fi } +get_home() +{ + [ "$1" ] && getent passwd "$1" | (IFS=: read _ _ _ _ _ h _; echo $h) +} + set -e @@ -198,6 +203,11 @@ username=$(id -un) uid=${username}@${cryptonomic_hostname} # 2. CHECK IF EXISTING SECRET KEY +if [ "$SUDO_USER" -a ! "$GNUPGHOME" ] +then + GNUPGHOME=$(get_home "$SUDO_USER")/.gnupg + export GNUPGHOME +fi t=$(gpg -K --with-colons) if [ "$t" ] then -- cgit v1.2.3