summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-07-30 21:29:45 +0000
committerZac Medico <zmedico@gentoo.org>2009-07-30 21:29:45 +0000
commit22f3f0a604b89334dcee15be6394ddf97fa32b0d (patch)
tree202e59fced9c42ccd620ecc528d13282bb966845
parentUpdating find_updated_config_files function description (diff)
downloadportage-multirepo-22f3f0a604b89334dcee15be6394ddf97fa32b0d.tar.gz
portage-multirepo-22f3f0a604b89334dcee15be6394ddf97fa32b0d.tar.bz2
portage-multirepo-22f3f0a604b89334dcee15be6394ddf97fa32b0d.zip
Move the setsid code (from bug #278895) as early as possible.
svn path=/main/trunk/; revision=13861
-rwxr-xr-xbin/ebuild.sh35
1 files changed, 17 insertions, 18 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index bd32f85f..794738f1 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -18,6 +18,23 @@ if [ -n "${PORTAGE_ROOTPATH}" ] ; then
unset PORTAGE_ROOTPATH
fi
+ROOTPATH=${ROOTPATH##:}
+ROOTPATH=${ROOTPATH%%:}
+PREROOTPATH=${PREROOTPATH##:}
+PREROOTPATH=${PREROOTPATH%%:}
+PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin${ROOTPATH:+:}$ROOTPATH
+export PATH
+
+if [[ -z $PORTAGE_SETSID && -n $1 && $1 != depend ]] ; then
+ if type -P setsid >/dev/null ; then
+ # Use setsid to create a new login session so that we can use SIGHUP
+ # to ensure that no orphaned subprocesses are left running.
+ export PORTAGE_SETSID=1
+ exec setsid "$PORTAGE_BIN_PATH/ebuild.sh" "$@"
+ fi
+fi
+[[ $PORTAGE_SETSID = 1 ]] && trap 'trap : SIGHUP ; kill -s SIGHUP 0 ;' EXIT
+
# These two functions wrap sourcing and calling respectively. At present they
# perform a qa check to make sure eclasses and ebuilds and profiles don't mess
# with shell opts (shopts). Ebuilds/eclasses changing shopts should reset them
@@ -64,24 +81,6 @@ unalias -a
# Unset some variables that break things.
unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
-ROOTPATH=${ROOTPATH##:}
-ROOTPATH=${ROOTPATH%%:}
-PREROOTPATH=${PREROOTPATH##:}
-PREROOTPATH=${PREROOTPATH%%:}
-PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin${ROOTPATH:+:}$ROOTPATH
-export PATH
-
-if [[ -z $PORTAGE_SETSID && \
- -n $EBUILD_SH_ARGS && $EBUILD_SH_ARGS != depend ]] ; then
- if type -P setsid >/dev/null ; then
- # Use setsid to create a new login session so that we can use SIGHUP
- # to ensure that no orphaned subprocesses are left running.
- export PORTAGE_SETSID=1
- exec setsid "$PORTAGE_BIN_PATH/ebuild.sh" $EBUILD_SH_ARGS
- fi
-fi
-trap '[[ $PORTAGE_SETSID = 1 ]] && { trap : SIGHUP ; kill -s SIGHUP 0 ; }' EXIT
-
source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null
# Set IMAGE for minimal backward compatibility with