2 ###########################################################################
3 # Copyright 2017 IoT.bzh
5 # author: Sebastien Douheret <sebastien@iot.bzh>
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 ###########################################################################
22 [ -z "$XDS_AGENT_BASEURL" ] && XDS_AGENT_BASEURL="http://iot.bzh/download/public/2017/XDS/xds-agent/"
23 [ -z "$DEST_DIR" ] && DEST_DIR=./webapp/dist/assets/xds-agent-tarballs
25 # Fisrt check if we can access to iot.bzh (aka ovh.iot)
26 ping -c 1 -W 2 www.ovh.iot > /dev/null
27 if [ "$?" != "0" ]; then
28 echo "iot.bzh website not accessible !"
32 TARBALLS=$(curl -s ${XDS_AGENT_BASEURL} | grep -oP 'href="[^"]*.zip"' | cut -d '"' -f 2)
35 echo "Usage: $(basename $0) [-h|--help] [-noclean] [-a|--arch <arch name>] [-l|--list]"
40 while [ $# -ne 0 ]; do
46 echo "Available xds-agent tarballs:"
47 for t in $TARBALLS; do echo " $t"; done
54 echo "Invalid argument: $1"
61 if [ ! -d ${DEST_DIR} ]; then
62 echo "Invalid destination directory: ${DEST_DIR}"
66 # Get not existing tarballs
68 for file in $TARBALLS; do
69 DESTFILE=${DEST_DIR}/${file}
70 if [ ! -f $DESTFILE ]; then
71 echo -n " Downloading ${file}... "
72 wget -q "${XDS_AGENT_BASEURL}/${file}" -O ${DESTFILE}
73 if [ "$?" != 0 ]; then