Add vmbuild script, for want of anywhere else to keep it.
[cdist.git] / vmbuild
1 #!/bin/bash
2
3 if [ "$1" == "" ]; then
4   echo "Syntax: $0 <target> [<checkout>]"
5 fi
6
7 IFS='-' read distro version bits <<< $1
8
9 if [ "$2" != "" ]; then
10   checkout="-c $2"
11 fi
12
13 if [ "$bits" == "32" ]; then
14   port=2000
15 elif [ "$bits" == "64" ]; then
16   port=2001
17 else
18   echo "Unrecognised bit depth $bits"
19   exit 1
20 fi
21
22 nohup vboxheadless --startvm fedora-22-$bits &
23 sleep 10
24 ssh -p $port carl@localhost "rm -rf fedora-*"
25 ssh -p $port carl@localhost cdist -p dcpomatic -c $checkout -t host package
26 scp -P $port carl@localhost:fedora-22-$bits/* .
27 ssh -p $port carl@localhost "sudo /sbin/poweroff"
28