-
Notifications
You must be signed in to change notification settings - Fork 31
/
release_virtualbox.sh
executable file
·47 lines (35 loc) · 1.22 KB
/
release_virtualbox.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
#!/bin/bash
#
# This script take a VM and install GNS3 server on it
#
# You need to pass GNS3 version as parameter
#
set -e
export PATH=$PATH:/Applications/VMware\ OVF\ Tool/
export GNS3_VERSION=`echo $1 | sed "s/^v//"`
if [ "$GNS3_VERSION" == "" ]
then
echo "You need to pass the GNS3 version as parameter"
exit 1
fi
export GNS3_UPDATE_FLAVOR=`echo -n $GNS3_VERSION | sed "s/\.[^.]*$//"`
echo "Build VM for GNS3 $GNS3_VERSION"
echo "Update flavor: $GNS3_UPDATE_FLAVOR"
rm -Rf output-*
#export GNS3VM_VERSION=`python last_vm_version.py`
export GNS3VM_VERSION="0.10.14"
export GNS3_SRC="/tmp/GNS3VM.VirtualBox.${GNS3VM_VERSION}.ova"
if [[ ! -f $GNS3_SRC ]]
then
export GNS3VM_URL="https://github.com/GNS3/gns3-vm/releases/download/v${GNS3VM_VERSION}/GNS3.VM.VirtualBox.${GNS3VM_VERSION}.zip"
echo "Download $GNS3VM_URL"
curl -Lk "$GNS3VM_URL" > "/tmp/GNS3VM.VirtualBox.${GNS3VM_VERSION}.zip"
unzip -p "/tmp/GNS3VM.VirtualBox.${GNS3VM_VERSION}.zip" "GNS3 VM.ova" > $GNS3_SRC
rm "/tmp/GNS3VM.VirtualBox.${GNS3VM_VERSION}.zip"
fi
packer build -only=virtualbox-ovf gns3_release.json
cd output-virtualbox-ovf
zip -9 "../GNS3 VM VirtualBox ${GNS3_VERSION}.zip" "GNS3 VM.ova"
cd ..
rm -Rf output-*
rm $GNS3_SRC