#!/bin/sh # This script is used to setup the OE Build Envrionment # Normally this is called as '. ./core-init-build-env ' # On some shell, we can get the path of this script when sources. Otherwise we # use the current directory as a fallback if [ -n "$BASH_SOURCE" ]; then CORE_OS_ROOT=$(dirname "$BASH_SOURCE") elif [ -n "$ZSH_NAME" ]; then CORE_OS_ROOT=$(dirname "$0") else CORE_OS_ROOT="$(pwd)" fi # Get a non relative path to the root directory CORE_OS_ROOT=$(readlink -f "${CORE_OS_ROOT}") # Set the path to bitbake, openembedded-core and the template directory BITBAKEDIR="${CORE_OS_ROOT}/bitbake" OEROOT="${CORE_OS_ROOT}/layers/openembedded-core" TEMPLATECONF="${CORE_OS_ROOT}/templates" # Sanity checks # This check detect if CORE_OS_ROOT is valid, by checking if the templates # directory exists. Usefull has we use $(pwd) as a fallback method on some shell if [ ! -d "$TEMPLATECONF" ]; then echo "Error: $TEMPLATECONF doesn't exist!" >&2 echo "Please run this script in oe-init-build-env's directory." >&2 return 1 fi # This check detect if BITBAKEDIR exist. It's a simple way to check that we have # fetched our git submodules if [ ! -d "$BITBAKEDIR" ]; then echo "Error: $BITBAKEDIR doesn't exist!" >&2 echo "Please ensure all git submodule are fetched." >&2 return 1 fi # Call the oe-init-build-env scripts of openembedded-core . "${OEROOT}/oe-init-build-env" "${1:-$CORE_OS_ROOT/build}" # Add the scripts directory of CoreOS to the path # Make sure our paths are at the beginning of $PATH for newpath in "${CORE_OS_ROOT}/scripts"; do # Remove any existences of $newpath from $PATH PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\2#g;s#^:##") # Add $newpath to $PATH PATH="$newpath:$PATH" done unset newpath export PATH