diff options
Diffstat (limited to 'scripts/envsetup.sh')
-rwxr-xr-x | scripts/envsetup.sh | 9 |
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 @@ | |||
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 | declare -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 |
11 | SOURCED=0 | 14 | SOURCED=0 |
@@ -22,6 +25,8 @@ if [[ $SOURCED -ne 1 ]]; then | |||
22 | fi | 25 | fi |
23 | 26 | ||
24 | METADIR=${METADIR:-${SOURCEDIR}/../..} | 27 | METADIR=${METADIR:-${SOURCEDIR}/../..} |
28 | DISTRO_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 | ||
26 | if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then | 31 | if [[ ! -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 |
34 | else | 39 | else |
35 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" | 40 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" |
36 | fi | 41 | fi |