diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-02-08 16:49:02 +0100 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-02-08 16:49:02 +0100 |
commit | e97eebc18d726aa55738d7e19513491cf58a6e3a (patch) | |
tree | 1e668dadc73cbe710cb1aaf059b43ef91defa01f /scripts/sdks/agl/add | |
parent | 0a53346ecd92e1281587c724631fdf76dc756fc7 (diff) |
Avoid duplicate SDK install dir - SPEC-1252
- install sdk in a directory that includes a unique id (built from install url
or path). SDKs are now install under:
<SDK_ROOT_DIR>/<PROFILE>/<VERSION>/<ARCH>/<UID>
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'scripts/sdks/agl/add')
-rwxr-xr-x | scripts/sdks/agl/add | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/scripts/sdks/agl/add b/scripts/sdks/agl/add index 7c8321c..80a0487 100755 --- a/scripts/sdks/agl/add +++ b/scripts/sdks/agl/add @@ -65,8 +65,8 @@ done [ "$SDK_FILE" = "" ] && [ "$URL" = "" ] && { echo "--file or --url option must be set"; exit 1; } # Create SDK root dir if needed -[ ! -d ${SDK_ROOT_DIR} ] && mkdir -p ${SDK_ROOT_DIR} -cd ${SDK_ROOT_DIR} || exit 1 +[ ! -d "${SDK_ROOT_DIR}" ] && mkdir -p "${SDK_ROOT_DIR}" +cd "${SDK_ROOT_DIR}" || exit 1 # Cleanup trap "cleanExit" 0 1 2 15 @@ -80,33 +80,33 @@ cleanExit () # Download sdk if [ "$URL" != "" ]; then TMPDIR=$(mktemp -d) - SDK_FILE=${TMPDIR}/$(basename ${URL}) - echo "Downloading $(basename ${SDK_FILE}) ..." + SDK_FILE=${TMPDIR}/$(basename "${URL}") + echo "Downloading $(basename "${SDK_FILE}") ..." wget --no-check-certificate "$URL" -O "${SDK_FILE}" || exit 1 fi # Retreive SDK info sdkNfo=$(${SCRIPTS_DIR}/get-sdk-info --file "${SDK_FILE}") if [ "$?" != "0" ]; then - echo $sdkNfo + echo "$sdkNfo" exit 1 fi -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 "$sdkNfo" |grep -Eo '"profile"[^,]*' |cut -d'"' -f4) +VERSION=$(echo "$sdkNfo" |grep -Eo '"version"[^,]*' |cut -d'"' -f4) +ARCH=$(echo "$sdkNfo" |grep -Eo '"arch"[^,]*' |cut -d'"' -f4) +DESTDIR=$(echo "$sdkNfo" |grep -Eo '"path"[^,]*' |cut -d'"' -f4) [ "$PROFILE" = "" ] && { echo "PROFILE is not set"; exit 1; } [ "$VERSION" = "" ] && { echo "VERSION is not set"; exit 1; } [ "$ARCH" = "" ] && { echo "ARCH is not set"; exit 1; } +[ "$DESTDIR" = "" ] && { echo "DESTDIR (path) is not set"; exit 1; } -DESTDIR=${SDK_ROOT_DIR}/${PROFILE}/${VERSION}/${ARCH} - -[ -d ${DESTDIR} ] && [ "$do_force" != "true" ] && { echo "SDK already installed in $DESTDIR"; exit 1; } +[ -d "${DESTDIR}" ] && [ "$do_force" != "true" ] && { echo "SDK already installed in $DESTDIR"; exit 1; } # Cleanup previous install -rm -rf ${DESTDIR} && mkdir -p ${DESTDIR} || exit 1 +rm -rf "${DESTDIR}" && mkdir -p "${DESTDIR}" || exit 1 # Install sdk -chmod +x ${SDK_FILE} -${SDK_FILE} ${DEBUG_OPT} -y -d ${DESTDIR} 2>&1 +chmod +x "${SDK_FILE}" +${SDK_FILE} ${DEBUG_OPT} -y -d "${DESTDIR}" 2>&1 |