diff options
Diffstat (limited to 'scripts/envsetup.sh')
-rwxr-xr-x | scripts/envsetup.sh | 18 |
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 @@ | |||
3 | SCRIPT="envsetup.sh" | 3 | SCRIPT="envsetup.sh" |
4 | MACHINE="$1" | 4 | MACHINE="$1" |
5 | BUILDDIR="build" | 5 | BUILDDIR="build" |
6 | DISTRO="poky-sota-systemd" | ||
7 | BASE_CONF="local.conf.base.append" | ||
8 | declare -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 |
11 | SOURCED=0 | 15 | SOURCED=0 |
@@ -22,6 +26,8 @@ if [[ $SOURCED -ne 1 ]]; then | |||
22 | fi | 26 | fi |
23 | 27 | ||
24 | METADIR=${METADIR:-${SOURCEDIR}/../..} | 28 | METADIR=${METADIR:-${SOURCEDIR}/../..} |
29 | DISTRO_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 | ||
26 | if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then | 32 | if [[ ! -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 | ||
34 | else | 46 | else |
35 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" | 47 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" |
36 | fi | 48 | fi |