forked from vdloo/android-x86-64-vagrant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·37 lines (31 loc) · 1.27 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
#!/bin/sh
# build the boxfile from the iso
(cd packer && packer build -force template.json)
# test if there is a boxfile where we expected it
if [ ! -f packer/android-x86_64-virtualbox.box ]; then
echo "Looks like something went wrong building the image. The building process is very flaky and fragile, maybe try again?"
exit 1
fi;
# make sure we have a vagrant-catalog-generator checkout
if [ ! -d vagrant-catalog-generator ]; then
git clone https://github.com/ByteInternet/vagrant-catalog-generator
else
cd vagrant-catalog-generator
git clean -xfd
git reset --hard origin/master
git pull origin master
cd ..
fi;
# put the image in an images directory with an incremental release number
mkdir -p images
RELEASE=$(find images | wc -l)
mv packer/android-x86_64-virtualbox.box images/android.virtualbox.release-${RELEASE}.box
# clean up old boxfiles, keep up to 5 releases
(cd vagrant-catalog-generator; export PYTHONPATH=.; \
python bin/prune_boxfiles.py \
--directory ../images --amount 5)
# generate the catalog.json with a filepath as url
(cd vagrant-catalog-generator; export PYTHONPATH=.; \
python bin/generate_catalog.py \
--directory ../images --base-url file://`pwd`/../images \
--description "android-x86_64 Vagrant box" --name android)