-if [ -z $1 ]; then
- echo -e "Usage: source envsetup.sh <board/device> [build dir]"
- return 1
-fi
-
-MACHINE="$1"
-
-
-case "$MACHINE" in
- "porter")
- # setup proprietary gfx drivers and multimedia packages
- COPY_MM_SCRIPT=meta-renesas/meta-rcar-gen2/scripts/setup_mm_packages.sh
- if [ -f $COPY_MM_SCRIPT ]; then
- . $COPY_MM_SCRIPT
- copy_mm_packages $1
- if [ $? -ne 0 ]; then
- echo "Copying gfx drivers and multimedia packages for '$1' failed."
- return 1
- fi
- fi
-
- if [ ! -d "$TEMPLATECONF" ]; then
- # set template conf for R-Car2 M2 Porter board
- TEMPLATECONF="$PWD/meta-renesas/meta-rcar-gen2/conf"
- fi
- ;;
- "porter-nogfx")
- MACHINE="porter"
- if [ ! -d "$TEMPLATECONF" ]; then
- # set template conf for R-Car2 M2 Porter board
- TEMPLATECONF="$PWD/meta-renesas/meta-rcar-gen2/conf"
- fi
- ;;
- "intel-corei7-64")
- ;;
- "minnowboard")
- # alias for minnowboardmax
- MACHINE="intel-corei7-64"
- ;;
- "qemux86")
- ;;
- "qemux86-64")
- ;;
- "wandboard")
- ;;
- *)
- # nothing to do here
- echo "WARN: '$MACHINE' is not tested by AGL Distro"
- ;;
-esac
-
-# set template conf for each <board/device>
-if [ -z "$TEMPLATECONF" ]; then
- if [ -d "$PWD/meta-agl-demo/templates/$MACHINE/conf" ]; then
- TEMPLATECONF="$PWD/meta-agl-demo/templates/$MACHINE/conf"
- fi
-fi
-
-echo "envsetup: Set '$1 as MACHINE."
-export MACHINE
-
-# fallback
-if [ ! -d "$TEMPLATECONF" ]; then
- # Allow to use templates at meta-agl-demo/conf
- TEMPLATECONF="$PWD/meta-agl-demo/conf"
+################################################################################
+#
+# The MIT License (MIT)
+#
+# Copyright (c) 2016 Stéphane Desneux <sdx@iot.bzh>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+################################################################################
+
+#################################################################################
+# IMPORTANT NOTICE
+#
+# This script is a compatiblity script with previous (AGL 1.0) envsetup script
+# It has been replaced by another script named "aglsetup.sh".
+#
+################################################################################
+
+# detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594
+SOURCED=0
+if [ -n "$ZSH_EVAL_CONTEXT" ]; then
+ [[ $ZSH_EVAL_CONTEXT =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $0) && pwd -P); }
+elif [ -n "$KSH_VERSION" ]; then
+ [[ "$(cd $(dirname -- $0) && pwd -P)/$(basename -- $0)" != "$(cd $(dirname -- ${.sh.file}) && pwd -P)/$(basename -- ${.sh.file})" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- ${.sh.file}) && pwd -P); }
+elif [ -n "$BASH_VERSION" ]; then
+ [[ $0 != "$BASH_SOURCE" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $BASH_SOURCE) && pwd -P); }