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