From cbbddf9a84163975a0a9110e384426567467cfd1 Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Fri, 26 May 2017 14:31:17 +0200 Subject: [PATCH] Retrieve dynamically SDKs files list (more generic) --- scripts/agl/install-agl-sdks.sh | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/scripts/agl/install-agl-sdks.sh b/scripts/agl/install-agl-sdks.sh index b65a08b..8edac2d 100755 --- a/scripts/agl/install-agl-sdks.sh +++ b/scripts/agl/install-agl-sdks.sh @@ -8,12 +8,27 @@ # Support only poky_agl profile for now PROFILE="poky-agl" +SDKS=$(curl -s ${SDK_BASEURL} | grep -oP 'href="[^"]*.sh"' | cut -d '"' -f 2) + usage() { - echo "Usage: $(basename $0) [-h|--help] [-noclean] -a|--arch " - echo "Sdk arch name is: aarch64 or arm32 or x86-64" + echo "Usage: $(basename $0) [-h|--help] [-noclean] [-a|--arch ] [-l|--list]" + echo "For example, arch name is: aarch64, armv7vehf or x86-64" exit 1 } +getFile() { + arch=$1 + for sdk in ${SDKS}; do + echo $sdk | grep "${PROFILE}.*${arch}.*.sh" > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo $sdk + return 0 + fi + done + echo "No SDK tarball found for arch $arch" + return 1 +} + do_cleanup=true FILE="" ARCH="" @@ -25,11 +40,15 @@ while [ $# -ne 0 ]; do -a|--arch) shift ARCH=$1 - case $1 in - aarch64) FILE="poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-aarch64-toolchain-3.90.0+snapshot.sh";; - arm32) FILE="poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-armv7vehf-neon-vfpv4-toolchain-3.90.0+snapshot.sh";; - x86-64) FILE="poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-3.90.0+snapshot.sh";; - esac + FILE=$(getFile $ARCH) + if [ "$?" != 0 ]; then + exit 1 + fi + ;; + -l|--list) + echo "Available SDKs tarballs:" + for sdk in $SDKS; do echo " $sdk"; done + exit 0 ;; -noclean) do_cleanup=false @@ -58,7 +77,7 @@ trap "cleanExit" 0 1 2 15 cleanExit () { if ($do_cleanup); then - rm -f ${XDT_SDK}/${FILE} + [[ -f ${XDT_SDK}/${FILE} ]] && rm -f ${XDT_SDK}/${FILE} fi } -- 2.16.6