update script to better manage the output directory
These changes allow you to reuse the directory or to
automatically delete it.
diff --git a/build-images b/build-images
index dba8cae..5c078a0 100755
--- a/build-images
+++ b/build-images
@@ -38,11 +38,22 @@
esac
done
-mkdir ${OUTDIR}
+if [ ! -z $DELETEDIR ] && [ -d ${OUTDIR} ] ; then
+ echo "INFO: Deleting past output directory: ${OUTDIR}"
+ rm -rf ${OUTDIR}
+fi
+
+if [ -d ${OUTDIR} ] && [ -z $REUSE ] ; then
+ echo "ERROR: directory [$OUTDIR] already exists. Delete this or run with RESUSE=1"
+ exit 1
+fi
LITDIR=${OUTDIR}/linaro-image-tools
-bzr branch ${BZRARGS} lp:linaro-image-tools ${LITDIR}
-export PYTHONPATH=${LITDIR}
+if [ ! -d ${OUTDIR} ] ; then
+ mkdir ${OUTDIR}
+ bzr branch ${BZRARGS} lp:linaro-image-tools ${LITDIR}
+fi
+export PYTHONPATH=${LITDIR}
SCRIPTDIR=$(dirname $(readlink -f $0))
${SCRIPTDIR}/build-images.py $*