9711b7937a1f90da5a71ac5bb741d54066b52bba
[joid.git] / juju / get-cloud-images
1 #!/bin/bash -e
2
3 folder=/srv/data/
4 sudo mkdir $folder || true
5
6 NODE_ARCTYPE=`arch`
7
8 if  [ "ppc64le" == "$NODE_ARCTYPE" ]; then
9     NODE_ARCHES="ppc64el"
10 elif [ "aarch64" == "$NODE_ARCTYPE" ]; then
11     NODE_ARCHES="arm64"
12 else
13     NODE_ARCHES="amd64"
14 fi
15
16
17 if grep -q 'virt-type: lxd' bundles.yaml; then
18     URLS=" \
19     http://download.cirros-cloud.net/daily/20161201/cirros-dl161201-$NODE_ARCTYPE-lxc.tar.gz \
20     http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-$NODE_ARCHES-root.tar.gz "
21
22 else
23     URLS=" \
24     http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-$NODE_ARCHES-uefi1.img \
25     http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-$NODE_ARCHES-uefi1.img \
26     http://mirror.catn.com/pub/catn/images/qcow2/centos6.4-x86_64-gold-master.img \
27     http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 \
28     http://download.cirros-cloud.net/daily/20161201/cirros-dl161201-$NODE_ARCTYPE-disk.img "
29 fi
30
31 for URL in $URLS
32 do
33 FILENAME=${URL##*/}
34 if [ -f $folder/$FILENAME ];
35 then
36     echo "$FILENAME already downloaded."
37 else
38     wget  -O  $folder/$FILENAME $URL
39 fi
40 done
41
42 echo "To download Windows image get there : https://cloudbase.it/windows-cloud-images/"