diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-10-22 17:22:21 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-10-22 17:22:35 +0200 |
commit | b33e880f23525b4f75cf35e39aa5082addef0fb7 (patch) | |
tree | 12eef7bf171f7dcd114bc675a8386707669db36e /scripts/sdks/agl/get-sdk-info | |
parent | 7939184660ed562f4b41c7a3983c7a4f69da52c7 (diff) |
Added support of new image_url field
Since commit ecef0475a0a9d51, url to download AGL image matching a
SDK has been introduced in SDK definition file. This commit adds
ImageURL field (json:image_url) in return json object of GET /sdks
Change-Id: If52c39292ac3d5e44c4f61b8b51c48d9661beb2d
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'scripts/sdks/agl/get-sdk-info')
-rwxr-xr-x | scripts/sdks/agl/get-sdk-info | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/scripts/sdks/agl/get-sdk-info b/scripts/sdks/agl/get-sdk-info index 485d5fe..12892ac 100755 --- a/scripts/sdks/agl/get-sdk-info +++ b/scripts/sdks/agl/get-sdk-info @@ -89,6 +89,7 @@ if [ "${SDK_FILE}" != "" ]; then filename=$(basename "${SDK_FILE}") sdkUrl=file://${SDK_FILE} + imageUrl="" sdkDate=$(stat -c %y "${SDK_FILE}") sdkSize=$(/bin/ls -sh "${SDK_FILE}" |cut -d' ' -f1) @@ -96,6 +97,7 @@ elif [ "${URL}" != "" ]; then filename=$(basename "${URL}") sdkUrl=${URL} + imageUrl="" sdkDate="" sdkSize="" @@ -124,6 +126,8 @@ installPath=${SDK_ROOT_DIR}/${profile}/${version}/${arch} [ "${version}" = "" ] && { echo "version not set"; exit 8; } [ "${arch}" = "" ] && { echo " arch not set"; exit 9; } +sdkName=${profile}_${arch}_${version} + # Define a unique ID to be able to distinguish for example corei7-64 from qemux86-64 if [ "${UUID}" = "" ]; then curInstDir=$(ls -d "${installPath}/*" 2> /dev/null) @@ -146,9 +150,26 @@ if [ -d "${installPath}" ]; then [ "${envFile}" != "" ] && status="Installed" fi +sdkDef="" +if [ "${UUID}" != "" ]; then + sdkDef=$($(dirname "$0")/db-dump | jq '.[] | select(.uuid=="'${UUID}'")') +elif [ "${URL}" != "" ]; then + sdkDef=$($(dirname "$0")/db-dump | jq '.[] | select(.url=="'${URL}'")') +fi + +if [ "${sdkDef}" != "" ]; then + sdkName=$(echo "$sdkDef" | jq -r .name) + [ "$UUID" = "" ] && UUID=$(echo "$sdkDef" | jq -r .uuid) + [ "$sdkUrl" = "" ] && sdkUrl=$(echo "$sdkDef" | jq -r .url) + [ "$imageUrl" = "" ] && imageUrl=$(echo "$sdkDef" | jq -r .image_url) + [ "$sdkDate" = "" ] && sdkDate=$(echo "$sdkDef" | jq -r .date) + [ "$sdkSize" = "" ] && sdkSize=$(echo "$sdkDef" | jq -r .size) + [ "$MD5VAL" = "" ] && MD5VAL=$(echo "$sdkDef" | jq -r .md5sum) +fi + read -r -d '' res <<- EndOfMessage { - "name": "${profile}_${arch}_${version}", + "name": "${sdkName}", "uuid": "${UUID}", "description": "AGL SDK ${arch} (version ${version})", "profile": "${profile}", @@ -156,6 +177,7 @@ read -r -d '' res <<- EndOfMessage "arch": "${arch}", "path": "${installPath}", "url": "${sdkUrl}", + "image_url": "${imageUrl}", "status": "${status}", "date": "${sdkDate}", "size": "${sdkSize}", |