Tweak vmbuild.
authorCarl Hetherington <cth@carlh.net>
Thu, 1 Oct 2015 20:50:22 +0000 (21:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 1 Oct 2015 20:50:22 +0000 (21:50 +0100)
vmbuild

diff --git a/vmbuild b/vmbuild
index f8dc117378765e36a6dea4aef1e9d7d6bfb46255..3df7840af016b3c061f69e6f3ddcb4a417461eab 100755 (executable)
--- a/vmbuild
+++ b/vmbuild
@@ -1,28 +1,29 @@
 #!/bin/bash
 
-if [ "$1" == "" ]; then
-  echo "Syntax: $0 <target> [<checkout>]"
+if [ "$1" == "" -o "$2" == "" ]; then
+    echo "Syntax: $0 <target> <checkout> [<output-dir>]"
 fi
 
 IFS='-' read distro version bits <<< $1
 
-if [ "$2" != "" ]; then
-  checkout="-c $2"
-fi
+bits=$1
+checkout=$2
+output=$3
 
 if [ "$bits" == "32" ]; then
-  port=2000
+    port=2000
 elif [ "$bits" == "64" ]; then
-  port=2001
+    port=2001
 else
-  echo "Unrecognised bit depth $bits"
-  exit 1
+    echo "Unrecognised bit depth $bits"
+    exit 1
 fi
 
 nohup vboxheadless --startvm fedora-22-$bits &
 sleep 10
 ssh -p $port carl@localhost "rm -rf fedora-*"
 ssh -p $port carl@localhost cdist -p dcpomatic -c $checkout -t host package
-scp -P $port carl@localhost:fedora-22-$bits/* .
+if [ "$output" != "" ]; then
+    scp -P $port carl@localhost:fedora-22-$bits/* $output/
+fi
 ssh -p $port carl@localhost "sudo /sbin/poweroff"
-