Use prepared model and scripts if exist
Change-Id: I9186ad365f5f3f330a11930fecd0e18fd7465ae0
diff --git a/day01-image/run.example.sh b/day01-image/run.example.sh
index 6732787..bc4a811 100755
--- a/day01-image/run.example.sh
+++ b/day01-image/run.example.sh
@@ -34,20 +34,22 @@
export PACKER_LOG=1
pushd config-drive
- [ -d model ] && rm -rf model
- git clone ${CLUSTER_MODEL} model/
- pushd model
- git fetch ${CLUSTER_MODEL} ${CLUSTER_MODEL_REF} && git checkout FETCH_HEAD
- pushd classes/system
- git submodule init
- git submodule update
+ if [ ! -e model ]; then
+ git clone ${CLUSTER_MODEL} model/
+ pushd model
+ git fetch ${CLUSTER_MODEL} ${CLUSTER_MODEL_REF} && git checkout FETCH_HEAD
+ pushd classes/system
+ git submodule init
+ git submodule update
+ popd
popd
- popd
- [ -d salt_scripts ] && rm -rf salt_scripts
- git clone ${GIT_SALT_FORMULAS_SCRIPTS} salt_scripts/
- pushd salt_scripts
+ fi
+ if [ ! -e salt_scripts ]; then
+ git clone ${GIT_SALT_FORMULAS_SCRIPTS} salt_scripts/
+ pushd salt_scripts
git fetch ${GIT_SALT_FORMULAS_SCRIPTS} ${SCRIPTS_REF} && git checkout FETCH_HEAD
- popd
+ popd
+ fi
popd
[ -f config-drive/cloudata.iso ] && rm -v config-drive/cloudata.iso