-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.sh
executable file
·51 lines (40 loc) · 1.32 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
#!/bin/bash
set -ex
# FIXME: Use system Packer if possible
#PACKER=$(which packer)
echo "--- Fill version asset"
# if [[ $GITHUB_REF == refs/tags/*-rc* ]]; then
# remove rc label
# VERSION=${GITHUB_REF#refs/tags/}
# VERSION=${VERSION/-rc*/}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION=$(git describe --always)
fi
echo $VERSION > assets/clover_vm_version
#if [ "x${PACKER}" == "x" ]; then
PACKER="./packer"
if [ ! -f ${PACKER} ]; then
echo "Packer not found; downloading v1.5.4 from Hashicorp"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS=linux
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS=darwin
fi
wget --progress=dot:giga https://releases.hashicorp.com/packer/1.5.4/packer_1.5.4_${OS}_amd64.zip
unzip packer_1.5.4_${OS}_amd64.zip
rm packer_1.5.4_${OS}_amd64.zip
fi
echo "--- Using Packer version $(${PACKER} --version)"
if [ ! -f output-virtualbox-iso/clover-devel.ova ]; then
echo "--- Building base image"
${PACKER} build -only=virtualbox-iso base_vm.json || true
fi
echo "--- Building extended image"
${PACKER} build ros_ide_vm.json
echo "--- Marking the VM"
VM_NAME="clover-devel_${VERSION}.ova"
mv ./output-virtualbox-ovf/clover-devel.ova ./output-virtualbox-ovf/${VM_NAME}
ls -l output-virtualbox-ovf
echo "--- All done!"