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>
This commit is contained in:
parent
cdf4473332
commit
61e8fdba04
|
@ -25,27 +25,31 @@
|
||||||
# being sourced. To workaround the shell limitation use "set arg1" prior
|
# being sourced. To workaround the shell limitation use "set arg1" prior
|
||||||
# to sourcing this script.
|
# to sourcing this script.
|
||||||
#
|
#
|
||||||
if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./oe-init-build-env" ]; then
|
if [ -n "$BASH_SOURCE" ]; then
|
||||||
echo "Error: This script needs to be sourced. Please run as '. ./oe-init-build-env'"
|
OEROOT="`dirname $BASH_SOURCE`"
|
||||||
|
elif [ -n "$ZSH_NAME" ]; then
|
||||||
|
OEROOT="`dirname $0`"
|
||||||
else
|
else
|
||||||
if [ -n "$BASH_SOURCE" ]; then
|
OEROOT="`pwd`"
|
||||||
OEROOT="`dirname $BASH_SOURCE`"
|
|
||||||
elif [ -n "$ZSH_NAME" ]; then
|
|
||||||
OEROOT="`dirname $0`"
|
|
||||||
else
|
|
||||||
OEROOT="`pwd`"
|
|
||||||
fi
|
|
||||||
if [ -n "$BBSERVER" ]; then
|
|
||||||
unset BBSERVER
|
|
||||||
fi
|
|
||||||
OEROOT=`readlink -f "$OEROOT"`
|
|
||||||
export OEROOT
|
|
||||||
. $OEROOT/scripts/oe-buildenv-internal && \
|
|
||||||
$OEROOT/scripts/oe-setup-builddir && \
|
|
||||||
[ -n "$BUILDDIR" ] && cd $BUILDDIR
|
|
||||||
unset OEROOT
|
|
||||||
unset BBPATH
|
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$BBSERVER" ]; then
|
||||||
|
unset BBSERVER
|
||||||
|
fi
|
||||||
|
THIS_SCRIPT=$OEROOT/oe-init-build-env
|
||||||
|
|
||||||
|
if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
|
||||||
|
echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
OEROOT=`readlink -f "$OEROOT"`
|
||||||
|
export OEROOT
|
||||||
|
. $OEROOT/scripts/oe-buildenv-internal && \
|
||||||
|
$OEROOT/scripts/oe-setup-builddir && \
|
||||||
|
[ -n "$BUILDDIR" ] && cd $BUILDDIR
|
||||||
|
unset OEROOT
|
||||||
|
unset BBPATH
|
||||||
|
unset THIS_SCRIPT
|
||||||
|
|
||||||
# Shutdown any bitbake server if the BBSERVER variable is not set
|
# Shutdown any bitbake server if the BBSERVER variable is not set
|
||||||
if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then
|
if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then
|
||||||
|
|
Loading…
Reference in New Issue