diff options
-rw-r--r-- | selfpublish.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/selfpublish.sh b/selfpublish.sh index c11eb8f..6ebf36b 100644 --- a/selfpublish.sh +++ b/selfpublish.sh | |||
@@ -187,6 +187,11 @@ verbose() | |||
187 | "$@" | 187 | "$@" |
188 | fi | 188 | fi |
189 | } | 189 | } |
190 | get_home() | ||
191 | { | ||
192 | [ "$1" ] && getent passwd "$1" | (IFS=: read _ _ _ _ _ h _; echo $h) | ||
193 | } | ||
194 | |||
190 | 195 | ||
191 | set -e | 196 | set -e |
192 | 197 | ||
@@ -198,6 +203,11 @@ username=$(id -un) | |||
198 | uid=${username}@${cryptonomic_hostname} | 203 | uid=${username}@${cryptonomic_hostname} |
199 | 204 | ||
200 | # 2. CHECK IF EXISTING SECRET KEY | 205 | # 2. CHECK IF EXISTING SECRET KEY |
206 | if [ "$SUDO_USER" -a ! "$GNUPGHOME" ] | ||
207 | then | ||
208 | GNUPGHOME=$(get_home "$SUDO_USER")/.gnupg | ||
209 | export GNUPGHOME | ||
210 | fi | ||
201 | t=$(gpg -K --with-colons) | 211 | t=$(gpg -K --with-colons) |
202 | if [ "$t" ] | 212 | if [ "$t" ] |
203 | then | 213 | then |