enter_chroot: add support for passing through GNUPGHOME

When running under jenkins the $GNUPGHOME may be located under the
current build directory instead of $HOME to avoid conflicting with other
jobs on the same build host.
This commit is contained in:
Michael Marineau 2015-11-29 14:02:50 -08:00
parent 7cea7f4d6f
commit 39a3a48a18
2 changed files with 4 additions and 2 deletions

View File

@ -231,6 +231,7 @@ load_environment_whitelist() {
GIT_PROXY_COMMAND
GIT_SSH
RSYNC_PROXY
GNUPGHOME
GPG_AGENT_INFO
SSH_AGENT_PID
SSH_AUTH_SOCK

View File

@ -293,9 +293,10 @@ setup_env() {
fi
# Mount GnuPG's data directory for signing uploads
if [[ -d "$SUDO_HOME/.gnupg" ]]; then
: ${GNUPGHOME:="$SUDO_HOME/.gnupg"}
if [[ -d "${GNUPGHOME}" ]]; then
debug "Mounting GnuPG"
setup_mount "${SUDO_HOME}/.gnupg" "--bind" "/home/${SUDO_USER}/.gnupg"
setup_mount "${GNUPGHOME}" "--bind" "${GNUPGHOME}"
# bind mount the gpg agent dir if available
GPG_AGENT_DIR="${GPG_AGENT_INFO%/*}"