forked from chef/bento
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
80 lines (59 loc) · 1.45 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
set -eo pipefail
source ~/.bashrc
env
function inline_image {
printf '\033]1338;url='%s';alt='%s'\a\n' "$1" "$2"
}
inline_image 'https://oaxacaborn.files.wordpress.com/2012/02/clean-all-the-things-via-hyperbole-and-a-half.png' 'Clean All The Things'
echo "--- Cleaning up after VirtualBox"
for i in $(vboxmanage list runningvms | awk '{print $1}' | sed 's/"//g')
do
echo "Powering off $i"
vboxmanage controlvm "$i" poweroff
done
for i in $(vboxmanage list vms | awk '{print $1}' | sed 's/"//g')
do
echo "Unregistering $i"
sleep 10
vboxmanage unregistervm "$i"
done
for i in ~/VirtualBox\ VMs/*
do
echo "Removing $i"
rm -rf ~/VirtualBox\ VMs/"$i"
done
echo "--- Cleaning up after Parallels"
for i in $(prlctl list --no-header --output name)
do
echo "Powering off $i"
prlctl stop "$i" --kill
sleep 10
done
for i in $(prlctl list --all --no-header --output uuid)
do
echo "Unregistering $i"
prlctl unregister "$i"
done
echo "--- Cleaning up after VMware"
for i in $(vmrun list | grep -v "Total")
do
echo "Stopping $i"
vmrun stop "$i"
sleep 10
echo "Deleting $i"
vmrun deleteVM "$i"
done
echo "--- Cleaning up after Packer"
rake clean
echo "--- Build $PLATFORM-$BENTO_PROVIDERS"
rake build_box[$PLATFORM]
echo "--- Test $PLATFORM-$BENTO_PROVIDERS"
rake test_all
if [ "$BENTO_UPLOAD" -eq 1 ]
then
echo "--- Upload Boxes to Atlas and S3"
rake upload_all
echo "--- Release Boxes on Atlas"
rake release_all
fi