forked from marvel-nccr/quantum-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_image.sh
executable file
·49 lines (40 loc) · 1.53 KB
/
create_image.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
#!/bin/bash
set -e
( echo "" | envsubst ) || (echo "envsubst not found, install e.g. via 'brew install gettext' + read information in output to finalize installation" ; exit 1)
echo "### Parsing globalconfig.yml"
source other_stuff/yaml_parser.sh
eval $(parse_yaml globalconfig.yml)
echo "### Halting any running machines"
vagrant halt # shut down machine
#vboxmanage list vms
vm_id="$vm_name $vm_version"
echo "### Exporting '$vm_id'"
git_tag=`git describe --abbrev=0`
if [ "$git_tag" != "$vm_version" ]; then
echo "latest git tag $git_tag and version number $vm_version do not agree"
# exit
fi
fname=quantum_mobile_${vm_version}.ova
[ -e $fname ] && rm $fname
vboxmanage export "$vm_id" \
-o $fname \
--vsys 0 \
--product "$vm_name" \
--version "$vm_version" \
--producturl "https://github.com/marvel-nccr/marvel-virtualmachine" \
--vendor "$vm_author" \
--vendorurl "$vm_author_url" \
--description "$vm_description" \
--eulafile "EULA.txt"
echo "### Find image in $fname"
echo "### Computing size of vm image and vm disk"
vm_image_size=`du -sh $fname | awk '{print $1}'`
vm_image_md5=`md5 $fname | awk '{print $4}'`
vdisk_path_grep=`vboxmanage showvminfo --machinereadable "$vm_id" | grep vmdk `
[[ $vdisk_path_grep =~ ^.*=\"(.*)\"$ ]]
vdisk_path=${BASH_REMATCH[1]}
vm_vdisk_size=`du -sh "$vdisk_path" | awk '{print $1}' `
export fname vm_version vm_user vm_password
export vm_image_size vm_image_md5 vm_vdisk_size
envsubst < INSTALL.md > INSTALL_${vm_version}.txt
echo "### Instructions in INSTALL_${vm_version}${rc}.txt"