From c40dca02f5c8e10405f1b6e30c53e3ca7b77782a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 2 Sep 2010 18:54:47 -0700 Subject: Unify to different pieces of code that handle sandbox considerations for TEMP, TMP, and TMPDIR variables. --- bin/ebuild.sh | 24 ++++++++++++------------ 1 file 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 -- cgit v1.2.3-1-g7c22