summaryrefslogtreecommitdiffstats
path: root/oe-init-build-env
diff options
context:
space:
mode:
authorGary Thomas <gary@mlbassoc.com>2014-02-24 17:11:47 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-11 15:11:41 (GMT)
commit61e8fdba041c04be05805ed511f2e9dd66f4fdfb (patch)
tree3dfe72b225521382d0442be0b17d4284a22fc2a6 /oe-init-build-env
parentcdf447333243c0f683470b395eac1e1f9b3dbce0 (diff)
downloadpoky-61e8fdba041c04be05805ed511f2e9dd66f4fdfb.tar.gz
oe-init-build-env: Improve script sourcing detection.
This script is only useful when sourced into a shell. These changes improve the detection of this operation, no matter how the script is referenced. (From OE-Core rev: cac863e958a0c8fe0f8a84dc194273c699f0c40f) Signed-off-by: Gary Thomas <gary@mlbassoc.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'oe-init-build-env')
-rwxr-xr-xoe-init-build-env42
1 files changed, 23 insertions, 19 deletions
diff --git a/oe-init-build-env b/oe-init-build-env
index 8ef32f3..5249513 100755
--- a/oe-init-build-env
+++ b/oe-init-build-env
@@ -25,27 +25,31 @@
25# being sourced. To workaround the shell limitation use "set arg1" prior 25# being sourced. To workaround the shell limitation use "set arg1" prior
26# to sourcing this script. 26# to sourcing this script.
27# 27#
28if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./oe-init-build-env" ]; then 28if [ -n "$BASH_SOURCE" ]; then
29 echo "Error: This script needs to be sourced. Please run as '. ./oe-init-build-env'" 29 OEROOT="`dirname $BASH_SOURCE`"
30elif [ -n "$ZSH_NAME" ]; then
31 OEROOT="`dirname $0`"
30else 32else
31 if [ -n "$BASH_SOURCE" ]; then 33 OEROOT="`pwd`"
32 OEROOT="`dirname $BASH_SOURCE`"
33 elif [ -n "$ZSH_NAME" ]; then
34 OEROOT="`dirname $0`"
35 else
36 OEROOT="`pwd`"
37 fi
38 if [ -n "$BBSERVER" ]; then
39 unset BBSERVER
40 fi
41 OEROOT=`readlink -f "$OEROOT"`
42 export OEROOT
43 . $OEROOT/scripts/oe-buildenv-internal && \
44 $OEROOT/scripts/oe-setup-builddir && \
45 [ -n "$BUILDDIR" ] && cd $BUILDDIR
46 unset OEROOT
47 unset BBPATH
48fi 34fi
35if [ -n "$BBSERVER" ]; then
36 unset BBSERVER
37fi
38THIS_SCRIPT=$OEROOT/oe-init-build-env
39
40if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
41 echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
42 exit 1
43fi
44
45OEROOT=`readlink -f "$OEROOT"`
46export OEROOT
47. $OEROOT/scripts/oe-buildenv-internal && \
48 $OEROOT/scripts/oe-setup-builddir && \
49 [ -n "$BUILDDIR" ] && cd $BUILDDIR
50unset OEROOT
51unset BBPATH
52unset THIS_SCRIPT
49 53
50# Shutdown any bitbake server if the BBSERVER variable is not set 54# Shutdown any bitbake server if the BBSERVER variable is not set
51if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then 55if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then