summaryrefslogtreecommitdiffstats
path: root/scripts/envsetup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/envsetup.sh')
-rwxr-xr-xscripts/envsetup.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh
index 5827bc2..4754e1d 100755
--- a/scripts/envsetup.sh
+++ b/scripts/envsetup.sh
@@ -3,9 +3,12 @@
3SCRIPT="envsetup.sh" 3SCRIPT="envsetup.sh"
4MACHINE="$1" 4MACHINE="$1"
5BUILDDIR="build" 5BUILDDIR="build"
6DISTRO="poky-sota-systemd"
7declare -A supported_distros=( ["poky-sota-systemd"]="local.conf.sample.append" ["poky-sota"]="local.nonsystemd.conf.sample.append" )
6 8
7[[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir]"; return 1; } 9[[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir] [distro=< poky-sota-systemd | poky-sota >]"; return 1; }
8[[ "$#" -eq 2 ]] && { BUILDDIR="$2"; } 10[[ "$#" -eq 2 ]] && { BUILDDIR="$2"; }
11[[ "$#" -eq 3 ]] && { DISTRO="$3"; }
9 12
10# detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594 13# detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594
11SOURCED=0 14SOURCED=0
@@ -22,6 +25,8 @@ if [[ $SOURCED -ne 1 ]]; then
22fi 25fi
23 26
24METADIR=${METADIR:-${SOURCEDIR}/../..} 27METADIR=${METADIR:-${SOURCEDIR}/../..}
28DISTRO_CONF=${supported_distros[$DISTRO]}
29[[ -n $DISTRO_CONF ]] && { echo "Using $DISTRO_CONF for the specified distro $DISTRO"; } || { echo "The specified distro $DISTRO is not supported"; return 1; }
25 30
26if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then 31if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then
27 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" 32 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
@@ -30,7 +35,7 @@ if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then
30 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf 35 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf
31 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf 36 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf
32 37
33 sed "s/##MACHINE##/$MACHINE/g" "${METADIR}/meta-updater/conf/local.conf.sample.append" >> conf/local.conf 38 sed "s/##MACHINE##/$MACHINE/g" "${METADIR}/meta-updater/conf/$DISTRO_CONF" >> conf/local.conf
34else 39else
35 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" 40 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
36fi 41fi