#!/bin/bash

set -x -e

export LATTICE_DIR=$PWD/lattice
export AWS_SSH_PRIVATE_KEY_PATH=$PWD/vagrant.pem

cat <<< "$AWS_SSH_PRIVATE_KEY" > "$AWS_SSH_PRIVATE_KEY_PATH"

curl -LO https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb
dpkg -i vagrant_1.7.4_x86_64.deb

while ! vagrant plugin install vagrant-aws; do
  sleep 5
done

vagrant box add lattice/ubuntu-trusty-64 --provider=aws

cp lattice-tar-build/lattice-*.tgz $LATTICE_DIR/lattice.tgz
pushd $LATTICE_DIR
  vagrant up --provider=aws
  export $(vagrant ssh -c "grep SYSTEM_DOMAIN /var/lattice/setup/lattice-environment" | egrep -o '(SYSTEM_DOMAIN=.+\.io)')
popd

sleep 60

echo $SYSTEM_DOMAIN > system_domain

#!/bin/bash

set -x -e

export LATTICE_DIR=$PWD/lattice
export AWS_SSH_PRIVATE_KEY_PATH=$PWD/vagrant.pem
export VAGRANT_TMP_DIR=$PWD/vagrant-tmp

mkdir -p $VAGRANT_TMP_DIR

cat <<< "$AWS_SSH_PRIVATE_KEY" > "$AWS_SSH_PRIVATE_KEY_PATH"

curl -LO https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb
dpkg -i vagrant_1.7.4_x86_64.deb

while ! vagrant plugin install vagrant-aws; do
  sleep 5
done

vagrant box add lattice/ubuntu-trusty-64 --provider=aws

cp lattice-tar-build/lattice-*.tgz $VAGRANT_TMP_DIR/lattice.tgz
cp lattice/Vagrantfile $VAGRANT_TMP_DIR/

pushd $VAGRANT_TMP_DIR
  vagrant up --provider=aws
  export $(vagrant ssh -c "grep SYSTEM_DOMAIN /var/lattice/setup/lattice-environment" | egrep -o '(SYSTEM_DOMAIN=.+\.io)')
popd

sleep 60

echo $SYSTEM_DOMAIN > system_domain

--- 
+++ 
@@ -4,9 +4,6 @@
 
 export LATTICE_DIR=$PWD/lattice
 export AWS_SSH_PRIVATE_KEY_PATH=$PWD/vagrant.pem
-export VAGRANT_TMP_DIR=$PWD/vagrant-tmp
-
-mkdir -p $VAGRANT_TMP_DIR
 
 cat <<< "$AWS_SSH_PRIVATE_KEY" > "$AWS_SSH_PRIVATE_KEY_PATH"
 
@@ -19,10 +16,8 @@
 
 vagrant box add lattice/ubuntu-trusty-64 --provider=aws
 
-cp lattice-tar-build/lattice-*.tgz $VAGRANT_TMP_DIR/lattice.tgz
-cp lattice/Vagrantfile $VAGRANT_TMP_DIR/
-
-pushd $VAGRANT_TMP_DIR
+cp lattice-tar-build/lattice-*.tgz $LATTICE_DIR/lattice.tgz
+pushd $LATTICE_DIR
   vagrant up --provider=aws
   export $(vagrant ssh -c "grep SYSTEM_DOMAIN /var/lattice/setup/lattice-environment" | egrep -o '(SYSTEM_DOMAIN=.+\.io)')
 popd
Copy lattice.tgz directly to repo for Vagrantfile compatibility

Signed-off-by: Stephen Levine <72d5489bdb659bea8b15ba0173fe796f11329883@pivotal.io>
