summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/setup-environment.sh (renamed from scripts/setup_environment.sh)42
1 files changed, 17 insertions, 25 deletions
diff --git a/scripts/setup_environment.sh b/scripts/setup-environment.sh
index aaba070..2ff9e29 100755
--- a/scripts/setup_environment.sh
+++ b/scripts/setup-environment.sh
@@ -21,22 +21,10 @@
21## 21##
22############################################################################# 22#############################################################################
23 23
24usage() {
25 echo "source setup-environment <build-dir>"
26}
27
28clean() {
29 unset BUILDDIR
30 unset TEMPLATECONF
31 unset LAYERSCONF
32}
33
34CWD=`pwd`
35
36while test -n "$1"; do 24while test -n "$1"; do
37 case "$1" in 25 case "$1" in
38 "--help" | "-h") 26 "--help" | "-h")
39 usage 27 echo "Usage: . $0 [build directory]"
40 return 0 28 return 0
41 ;; 29 ;;
42 *) 30 *)
@@ -46,18 +34,20 @@ while test -n "$1"; do
46 shift 34 shift
47done 35done
48 36
49if [ -z "${BUILDDIR}" ]; then 37THIS_SCRIPT="setup-environment.sh"
50 usage 38if [ "$(basename $0)" = "${THIS_SCRIPT}" ]; then
51 return 1 39 echo "Error: This script needs to be sourced. Please run as '. $0'"
40 exit 1
52fi 41fi
53 42
43BUILDDIR=${BUILDDIR:-build-${MACHINE}}
44
54if [ -z "$MACHINE" ]; then 45if [ -z "$MACHINE" ]; then
55 echo "MACHINE environment variable not defined" 46 echo "Error: MACHINE environment variable not defined"
56 clean
57 return 1 47 return 1
58fi 48fi
59 49
60if [ ! -f ${CWD}/${BUILDDIR}/conf/bblayers.conf ]; then 50if [ ! -f ${PWD}/${BUILDDIR}/conf/bblayers.conf ]; then
61 case ${MACHINE} in 51 case ${MACHINE} in
62 apalis-imx6) 52 apalis-imx6)
63 LAYERSCONF="bblayers.conf.toradex.sample" 53 LAYERSCONF="bblayers.conf.toradex.sample"
@@ -83,11 +73,13 @@ if [ ! -f ${CWD}/${BUILDDIR}/conf/bblayers.conf ]; then
83 ;; 73 ;;
84 esac 74 esac
85 75
86 mkdir -p ${CWD}/${BUILDDIR}/conf 76 mkdir -p ${PWD}/${BUILDDIR}/conf
87 cp ${CWD}/sources/meta-b2qt/conf/${LAYERSCONF} ${CWD}/${BUILDDIR}/conf/bblayers.conf 77 cp ${PWD}/sources/meta-b2qt/conf/${LAYERSCONF} ${PWD}/${BUILDDIR}/conf/bblayers.conf
88fi 78fi
89 79
90export TEMPLATECONF=${CWD}/sources/meta-b2qt/conf 80export TEMPLATECONF="${PWD}/sources/meta-b2qt/conf"
91cd sources/poky 81. sources/poky/oe-init-build-env ${BUILDDIR}
92. ./oe-init-build-env ${CWD}/${BUILDDIR} 82
93clean 83unset BUILDDIR
84unset TEMPLATECONF
85unset LAYERSCONF