aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/sdks/agl/add
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sdks/agl/add')
-rwxr-xr-xscripts/sdks/agl/add25
1 files changed, 17 insertions, 8 deletions
diff --git a/scripts/sdks/agl/add b/scripts/sdks/agl/add
index e9a9fd1..7c8321c 100755
--- a/scripts/sdks/agl/add
+++ b/scripts/sdks/agl/add
@@ -17,7 +17,8 @@
# limitations under the License.
###########################################################################
-. $(dirname "$0")/_env-init.sh
+SCRIPTS_DIR=$(cd $(dirname "$0") && pwd)
+. ${SCRIPTS_DIR}/_env-init.sh
usage() {
echo "Usage: $(basename $0) [-h|--help] [-f|--file <sdk-filename>] [-u|--url <https_url>] [--force] [--no-clean]"
@@ -27,10 +28,15 @@ usage() {
TMPDIR=""
SDK_FILE=""
URL=""
+DEBUG_OPT=""
do_cleanup=true
do_force=false
while [ $# -ne 0 ]; do
case $1 in
+ --debug)
+ set -x
+ DEBUG_OPT="-D"
+ ;;
-f|--file)
shift
SDK_FILE=$1
@@ -79,13 +85,16 @@ if [ "$URL" != "" ]; then
wget --no-check-certificate "$URL" -O "${SDK_FILE}" || exit 1
fi
-# Retreive default install dir to extract version
-offset=$(grep -na -m1 "^MARKER:$" "${SDK_FILE}" | cut -d':' -f1)
-eval $(head -n $offset "${SDK_FILE}" | grep ^DEFAULT_INSTALL_DIR= )
+# Retreive SDK info
+sdkNfo=$(${SCRIPTS_DIR}/get-sdk-info --file "${SDK_FILE}")
+if [ "$?" != "0" ]; then
+ echo $sdkNfo
+ exit 1
+fi
-PROFILE=$(basename $(dirname $DEFAULT_INSTALL_DIR))
-VERSION=$(basename $DEFAULT_INSTALL_DIR)
-ARCH=$(echo "$SDK_FILE" | sed -r 's/.*crosssdk-(.*)-toolchain.*/\1/')
+PROFILE=$(echo "$sdkNfo" |egrep -o '"profile"[^,]*' |cut -d'"' -f4)
+VERSION=$(echo "$sdkNfo" |egrep -o '"version"[^,]*' |cut -d'"' -f4)
+ARCH=$(echo "$sdkNfo" |egrep -o '"arch"[^,]*' |cut -d'"' -f4)
[ "$PROFILE" = "" ] && { echo "PROFILE is not set"; exit 1; }
[ "$VERSION" = "" ] && { echo "VERSION is not set"; exit 1; }
@@ -100,4 +109,4 @@ rm -rf ${DESTDIR} && mkdir -p ${DESTDIR} || exit 1
# Install sdk
chmod +x ${SDK_FILE}
-${SDK_FILE} -y -d ${DESTDIR}
+${SDK_FILE} ${DEBUG_OPT} -y -d ${DESTDIR} 2>&1