summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2016-05-03 11:31:08 +0200
committerFabian Groffen <grobian@gentoo.org>2016-05-03 11:31:08 +0200
commit2bb3c6940c3000924d145515832797ae5bf29f31 (patch)
tree7d2133e27a3e811d145afdda74e4970b7482a43e
parent+portage-2.2.28-r2: bump ebuildshell patch bug#155161 comment#32 (diff)
downloadprefix-2bb3c694.tar.gz
prefix-2bb3c694.tar.bz2
prefix-2bb3c694.zip
scripts/startprefix: retain some more useful env vars
-rw-r--r--scripts/startprefix.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/startprefix.in b/scripts/startprefix.in
index aafd04d710..861f02dd04 100644
--- a/scripts/startprefix.in
+++ b/scripts/startprefix.in
@@ -37,9 +37,15 @@ fi
# give a small notice
echo "Entering Gentoo Prefix ${EPREFIX}"
# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && DOPROFILEREAD="PROFILEREAD=${PROFILEREAD}"
-env -i HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL $DOPROFILEREAD $SHELL -l
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+# do it!
+env -i $RETAIN $SHELL -l
# and leave a message when we exit... the shell might return non-zero
# without having real problems, so don't send alarming messages about
# that