Updated the installer such that in test mode all built containers are
transferred to the install targets. This allows new containers to be
tested before they are added to the production list.
Changed the order in which some install steps were executed in test mode
to allow walking away from the process more quickly by prompting for
information earlier.
Updated the docker service instantiation to use the newly sumbmitted
compose files rather than the command line.
Once the installer is built in test mode it's started automatically
rather than requiring intervention and then exists when it's completed
the deployment of the cluster. This will be useful when integrating into
the automated build process later.

Change-Id: Id978cae69b53c605abefeb9b55f2671f9b9cfd20
diff --git a/install/BuildVoltha.sh b/install/BuildVoltha.sh
index b37a998..bcfb955 100755
--- a/install/BuildVoltha.sh
+++ b/install/BuildVoltha.sh
@@ -47,20 +47,19 @@
 
 
 # Run all the build commands
-ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i .vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr "cd /cord/incubator/voltha && . env.sh && make fetch && make production" | tee voltha_build.tmp
-
-rtrn=$#
-
-if [ $rtrn -ne 0 ]; then
-	rm -f voltha_build.tmp
-	exit 1
+if [ $# -eq 1 -a "$1" == "test" ]; then
+	ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \
+		.vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr \
+		"cd /cord/incubator/voltha && . env.sh && make fetch && make build"
+	rtrn=$?
+else
+	ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \
+		.vagrant/machines/voltha${uId}/libvirt/private_key vagrant@$ipAddr \
+		"cd /cord/incubator/voltha && . env.sh && make fetch && make production"
+	rtrn=$?
 fi
 
-egrep 'Makefile:[0-9]+: recipe for target .* failed' voltha_build.tmp
+echo "Build return code: $rtrn"
 
-rtrn=$#
-rm -f voltha_build.tmp
-if [ $rtrn -eq 0 ]; then
-	# An error occured, notify the caller
-	exit 1
-fi
+exit $rtrn
+