aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/prepare.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/prepare.sh')
-rwxr-xr-xdeploy/prepare.sh32
1 files changed, 26 insertions, 6 deletions
diff --git a/deploy/prepare.sh b/deploy/prepare.sh
index 1b0ded8c..704b540a 100755
--- a/deploy/prepare.sh
+++ b/deploy/prepare.sh
@@ -1,26 +1,46 @@
+
+function download_iso()
+{
+ iso_name=`basename $ISO_URL`
+ rm -f $WORK_DIR/cache/"$iso_name.md5"
+ curl --connect-timeout 10 -o $WORK_DIR/cache/"$iso_name.md5" $ISO_URL.md5
+ if [[ -f $WORK_DIR/cache/$iso_name ]]; then
+ local_md5=`md5sum $WORK_DIR/cache/$iso_name | cut -d ' ' -f 1`
+ repo_md5=`cat $WORK_DIR/cache/$iso_name.md5 | cut -d ' ' -f 1`
+ if [[ "$local_md5" == "$repo_md5" ]]; then
+ return
+ fi
+ fi
+
+ curl --connect-timeout 10 -o $WORK_DIR/cache/$iso_name $ISO_URL
+}
+
+
function prepare_env() {
export PYTHONPATH=/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages
sudo apt-get update -y
- sudo apt-get install mkisofs bc
+ sudo apt-get install mkisofs bc curl
sudo apt-get install git python-pip python-dev -y
sudo apt-get install libxslt-dev libxml2-dev libvirt-dev build-essential qemu-utils qemu-kvm libvirt-bin virtinst libmysqld-dev -y
sudo pip install --upgrade pip
sudo pip install --upgrade ansible
sudo pip install --upgrade virtualenv
+ sudo pip install --upgrade netaddr
+ sudo pip install --upgrade oslo.config
sudo service libvirt-bin restart
# prepare work dir
- sudo rm -rf $WORK_DIR
- mkdir -p $WORK_DIR
+ rm -rf $WORK_DIR/{installer,vm,network,iso,venv}
mkdir -p $WORK_DIR/installer
mkdir -p $WORK_DIR/vm
mkdir -p $WORK_DIR/network
mkdir -p $WORK_DIR/iso
mkdir -p $WORK_DIR/venv
+ mkdir -p $WORK_DIR/cache
- if [[ ! -f centos.iso ]];then
- wget -O $WORK_DIR/iso/centos.iso $ISO_URL
- fi
+ download_iso
+
+ cp $WORK_DIR/cache/`basename $ISO_URL` $WORK_DIR/iso/centos.iso -f
# copy compass
mkdir -p $WORK_DIR/mnt