summaryrefslogtreecommitdiff
path: root/provisioning/build-hackday-box.sh
blob: 858fc40b8d9fa13febecef98e27adc9f6cf0dd4f (plain)
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
#!/bin/bash
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.

PROVISIONING_PATH=$(dirname $0)
USER_AGENT_DIR="$PROVISIONING_PATH/.."

PACKAGE_FILE="hackday-pixelated-user-agent.box"
BOX_NAME="hackaday-pixelated-user-agent"

pushd $USER_AGENT_DIR

# clear old boxes
vagrant destroy -f source
vagrant destroy -f hackday
vagrant box remove $BOX_NAME
rm "$USER_AGENT_DIR/$PACKAGE_FILE"

# build from scratch
vagrant up source && \
vagrant package --output="$USER_AGENT_DIR/$PACKAGE_FILE" && \
vagrant box add $BOX_NAME $PACKAGE_FILE

SUCCESS=$?

popd

if [ $SUCCESS -eq 0 ] ; then
	echo
	echo "Created hackday box $PACKAGE_FILE"
	echo "If you want to test it, run"
	echo
	echo "vagrant up hackday"
else
	echo "Error while building hackday box" 1>&2
fi

exit $SUCCESS