summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-02 18:54:47 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-02 18:54:47 -0700
commitc40dca02f5c8e10405f1b6e30c53e3ca7b77782a (patch)
tree2dff25cc8a4f552e766e0d2a7a742eb44a5e5e40
parent52779f2bce9e16b4c78f744d850609c7a389d651 (diff)
downloadportage-c40dca02f5c8e10405f1b6e30c53e3ca7b77782a.tar.gz
portage-c40dca02f5c8e10405f1b6e30c53e3ca7b77782a.tar.bz2
portage-c40dca02f5c8e10405f1b6e30c53e3ca7b77782a.zip
Unify to different pieces of code that handle sandbox considerations for
TEMP, TMP, and TMPDIR variables.
-rwxr-xr-xbin/ebuild.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index f17e63b3e..6627c898d 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -19,12 +19,6 @@ fi
# environment by modifying our PATH.
unset BASH_ENV
-# Avoid sandbox violations in temporary directories.
-for x in TEMP TMP TMPDIR ; do
- [[ -n ${!x} ]] && export SANDBOX_WRITE="${SANDBOX_WRITE:+${SANDBOX_WRITE}:}${!x}"
-done
-unset x
-
ROOTPATH=${ROOTPATH##:}
ROOTPATH=${ROOTPATH%%:}
PREROOTPATH=${PREROOTPATH##:}
@@ -107,6 +101,18 @@ addwrite "${PORTAGE_TMPDIR}"
addread "/:${PORTAGE_TMPDIR}"
[[ -n ${PORTAGE_GPG_DIR} ]] && addpredict "${PORTAGE_GPG_DIR}"
+# Avoid sandbox violations in temporary directories.
+if [[ -w $T ]] ; then
+ export TEMP=$T
+ export TMP=$T
+ export TMPDIR=$T
+else
+ for x in TEMP TMP TMPDIR ; do
+ [[ -n ${!x} ]] && addwrite "${!x}"
+ done
+ unset x
+fi
+
lchown() {
chown -h "$@"
}
@@ -2079,12 +2085,6 @@ fi
#a reasonable default for $S
[[ -z ${S} ]] && export S=${WORKDIR}/${P}
-#some users have $TMP/$TMPDIR to a custom dir in their home ...
-#this will cause sandbox errors with some ./configure
-#scripts, so set it to $T.
-export TMP="${T}"
-export TMPDIR="${T}"
-
# Note: readonly variables interfere with preprocess_ebuild_env(), so
# declare them only after it has already run.
if [ "${EBUILD_PHASE}" != "depend" ] ; then