5 [ -z "$SDK_BASEURL" ] && SDK_BASEURL="http://iot.bzh/download/public/2017/XDS/sdk/"
6 [ -z "$XDT_SDK" ] && XDT_SDK=/xdt/sdk
8 # Support only poky_agl profile for now
11 # Dynamically retreive SDKs (reduce timeout in case of iot website is not available)
12 SDKS=$(curl -s ${SDK_BASEURL} --connect-timeout 10 | grep -oP 'href="[^"]*.sh"' | cut -d '"' -f 2) || echo "WARNING: IoT.bzh download site not available."
15 echo "Usage: $(basename $0) [-h|--help] [-clean] [-f|--file <agl-sdk-filename>] [-a|--arch <arch name>] [-l|--list]"
16 echo "For example, arch name is: aarch64, armv7vehf or corei7-64"
22 for sdk in ${SDKS}; do
23 echo $sdk | grep "${PROFILE}.*${arch}.*.sh" > /dev/null 2>&1
24 if [ "$?" = "0" ]; then
29 echo "No SDK tarball found for arch $arch"
36 while [ $# -ne 0 ]; do
50 echo "Available SDKs tarballs:"
51 for sdk in $SDKS; do echo " $sdk"; done
58 echo "Invalid argument: $1"
65 if [ "$ARCH" = "x86-64" ]; then
66 echo "Warning x86-64 architure name is deprecated, please use corei7-64 instead !"
70 [ ! -d ${XDT_SDK} ] && mkdir -p ${XDT_SDK}
72 if [ "$FILE" = "" ]; then
74 if [ "$?" != "0" ]; then
78 SDK_FILE=${XDT_SDK}/${FILE}
79 elif [ ! -f "$FILE" ]; then
80 echo "SDK file not found: $FILE"
83 DIR=$(cd $(dirname $FILE); pwd)
84 FILE=$(basename $FILE)
85 SDK_FILE=${DIR}/${FILE}
88 if [ "$ARCH" = "" ]; then
89 echo "Option -a|--arch must be set"
93 # Check that ARCH name matching SDK tarball filename
94 echo "$FILE" | grep "$ARCH" > /dev/null 2>&1
95 if [ "$?" = "1" ]; then
96 echo "ARCH and provided filename doesn't match !"
100 cd ${XDT_SDK} || exit 1
103 trap "cleanExit" 0 1 2 15
106 if ($do_cleanup); then
107 [[ -f ${SDK_FILE} ]] && rm -f ${SDK_FILE}
112 if [ ! -f "${SDK_FILE}" ]; then
114 wget "$SDK_BASEURL/$FILE" -O "${SDK_FILE}" || exit 1
117 # Retreive default install dir to extract version
118 offset=$(grep -na -m1 "^MARKER:$" "${SDK_FILE}" | cut -d':' -f1)
119 eval $(head -n $offset "${SDK_FILE}" | grep ^DEFAULT_INSTALL_DIR= )
120 VERSION=$(basename $DEFAULT_INSTALL_DIR)
122 [ "$PROFILE" = "" ] && { echo "PROFILE is not set"; exit 1; }
123 [ "$VERSION" = "" ] && { echo "VERSION is not set"; exit 1; }
125 DESTDIR=${XDT_SDK}/${PROFILE}/${VERSION}/${ARCH}
127 # Cleanup previous install
128 rm -rf ${DESTDIR} && mkdir -p ${DESTDIR} || exit 1
132 ${SDK_FILE} -y -d ${DESTDIR}