diff options
| author | lbonn <lbonn@users.noreply.github.com> | 2020-04-03 13:28:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-03 13:28:57 +0200 |
| commit | 177081df3a793ee0e028b33bd416cdff97eee471 (patch) | |
| tree | 32df8a12e6f67c339c393fd783a3dfa4ab0161ab | |
| parent | 561a4dc5028df10dc4acfef7fe77b9ec3d906f84 (diff) | |
| parent | 33c423b90305b5f382b3ed2a5902db3a09209a55 (diff) | |
| download | meta-updater-177081df3a793ee0e028b33bd416cdff97eee471.tar.gz | |
Merge pull request #710 from advancedtelematic/fix/envsetup-zsh
Fix envsetup when run in zsh
| -rwxr-xr-x | scripts/envsetup.sh | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh index a7ee877..c12f193 100755 --- a/scripts/envsetup.sh +++ b/scripts/envsetup.sh | |||
| @@ -6,15 +6,23 @@ BUILDDIR="build" | |||
| 6 | DISTRO="poky-sota-systemd" | 6 | DISTRO="poky-sota-systemd" |
| 7 | BASE_CONF="local.conf.base.append" | 7 | BASE_CONF="local.conf.base.append" |
| 8 | 8 | ||
| 9 | if [ -n "$ZSH_VERSION" ]; then | ||
| 10 | # be more compatible with bash | ||
| 11 | setopt shwordsplit | ||
| 12 | fi | ||
| 13 | |||
| 9 | # A definition of a dictionary with a list of configuration files that must be appended | 14 | # A definition of a dictionary with a list of configuration files that must be appended |
| 10 | # to resulting conf/local.conf file for each particular distribution. | 15 | # to resulting conf/local.conf file for each particular distribution. |
| 11 | declare -A supported_distros=( | 16 | declare -A supported_distros |
| 12 | ["poky-sota-systemd"]="local.conf.systemd.append" | 17 | supported_distros[poky-sota-systemd]="local.conf.systemd.append" |
| 13 | ["poky-sota"]="local.conf.base.append" | 18 | supported_distros[poky-sota]="local.conf.base.append" |
| 14 | ["poky"]="local.conf.systemd.append local.conf.nonostree.append" | 19 | supported_distros[poky]="local.conf.systemd.append local.conf.nonostree.append" |
| 15 | ) | 20 | |
| 21 | usage () { | ||
| 22 | echo "Usage: ${SCRIPT} <machine> [builddir] [distro=< poky-sota-systemd | poky-sota | poky >]" | ||
| 23 | } | ||
| 16 | 24 | ||
| 17 | [[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir] [distro=< poky-sota-systemd | poky-sota | poky >]"; return 1; } | 25 | [[ "$#" -lt 1 ]] && { usage; return 1; } |
| 18 | [[ "$#" -ge 2 ]] && { BUILDDIR="$2"; } | 26 | [[ "$#" -ge 2 ]] && { BUILDDIR="$2"; } |
| 19 | [[ "$#" -eq 3 ]] && { DISTRO="$3"; } | 27 | [[ "$#" -eq 3 ]] && { DISTRO="$3"; } |
| 20 | 28 | ||
| @@ -35,23 +43,27 @@ fi | |||
| 35 | METADIR=${METADIR:-${SOURCEDIR}/../..} | 43 | METADIR=${METADIR:-${SOURCEDIR}/../..} |
| 36 | 44 | ||
| 37 | if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then | 45 | if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then |
| 38 | declare -a DISTRO_CONFIGS=${supported_distros[$DISTRO]} | 46 | if [ -z "${supported_distros[$DISTRO]}" ]; then |
| 39 | [[ -n ${DISTRO_CONFIGS[@]} ]] && { echo "Using (${DISTRO_CONFIGS[*]}) for the specified distro '$DISTRO'"; } || { echo "The specified distro $DISTRO is not supported"; return 1; } | 47 | echo "The specified distro $DISTRO is not supported" |
| 48 | usage | ||
| 49 | return 1 | ||
| 50 | fi | ||
| 40 | 51 | ||
| 41 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" | 52 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" |
| 42 | 53 | ||
| 43 | echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf | 54 | echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf |
| 44 | cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf | 55 | cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf |
| 45 | cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf | 56 | cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf |
| 57 | |||
| 46 | sed -e "s/##MACHINE##/$MACHINE/g" \ | 58 | sed -e "s/##MACHINE##/$MACHINE/g" \ |
| 47 | -e "s/##DISTRO##/$DISTRO/g" \ | 59 | -e "s/##DISTRO##/$DISTRO/g" \ |
| 48 | "${METADIR}/meta-updater/conf/$BASE_CONF" >> conf/local.conf | 60 | "${METADIR}/meta-updater/conf/$BASE_CONF" >> conf/local.conf |
| 49 | 61 | ||
| 50 | for config in ${DISTRO_CONFIGS[@]}; do | 62 | for config in ${supported_distros[$DISTRO]}; do |
| 51 | if [[ "$BASE_CONF" != "$config" ]]; then | 63 | if [[ "$BASE_CONF" != "$config" ]]; then |
| 52 | cat "${METADIR}/meta-updater/conf/$config" >> conf/local.conf | 64 | cat "${METADIR}/meta-updater/conf/$config" >> conf/local.conf |
| 53 | fi | 65 | fi |
| 54 | done | 66 | done |
| 55 | else | 67 | else |
| 56 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" | 68 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" |
| 57 | fi \ No newline at end of file | 69 | fi |
