-
Notifications
You must be signed in to change notification settings - Fork 31
/
release_vmware.sh
executable file
·74 lines (59 loc) · 2.45 KB
/
release_vmware.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
#
# This script take a VM and install GNS3 server on it
#
# You need to pass the 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"
echo "Download VM"
#export GNS3VM_VERSION=`python last_vm_version.py`
export GNS3VM_VERSION="0.10.14"
export GNS3VM_URL="https://github.com/GNS3/gns3-vm/releases/download/v${GNS3VM_VERSION}/GNS3.VM.VMware.${GNS3VM_VERSION}.zip"
if [[ ! -f "/tmp/GNS3VM.VMware.${GNS3VM_VERSION}.zip" ]]
then
echo "Download $GNS3VM_URL"
curl -Lk "$GNS3VM_URL" > "/tmp/GNS3VM.VMware.${GNS3VM_VERSION}.zip"
fi
unzip -p "/tmp/GNS3VM.VMware.${GNS3VM_VERSION}.zip" "GNS3 VM.ova" > "/tmp/GNS3VM.VMWare.${GNS3VM_VERSION}.ova"
echo "Convert to VMX file format"
rm -Rf output-vmx
mkdir output-vmx
ovftool --allowAllExtraConfig "/tmp/GNS3VM.VMWare.${GNS3VM_VERSION}.ova" output-vmx/gns3.vmx
echo "Upgrade with packer"
rm "/tmp/GNS3VM.VMWare.${GNS3VM_VERSION}.ova"
rm -Rf output-vmware-vmx
export GNS3_SRC="output-vmx/gns3.vmx"
packer build -only=vmware-vmx gns3_release.json
cd output-vmware-vmx
echo "Export to OVA"
ovftool --extraConfig:vhv.enable=true \
--extraConfig:ethernet0.virtualDev=e1000 \
--extraConfig:ethernet0.pciSlotNumber=32 \
--extraConfig:ethernet0.connectionType=hostonly \
--extraConfig:ethernet1.present=true \
--extraConfig:ethernet1.startConnected=true \
--extraConfig:ethernet1.connectionType=nat \
--extraConfig:ethernet1.addressType=generated \
--extraConfig:ethernet1.generatedAddressOffset=10 \
--extraConfig:ethernet1.wakeOnPcktRcv=false \
--extraConfig:ethernet1.pciSlotNumber=33 \
--extraConfig:ethernet1.virtualDev=e1000 \
--allowAllExtraConfig \
"GNS3 VM.vmx" "GNS3 VM.ova"
echo "Fix OVA network"
mv "GNS3 VM.ova" "GNS3 VM.tmp.ova"
python3 ../fix_vmware_ova_network.py "GNS3 VM.tmp.ova" "GNS3 VM.ova"
zip -9 "../GNS3 VM VMware Workstation ${GNS3_VERSION}.zip" "GNS3 VM.ova"
cd ..
rm -Rf output-*
#rm "/tmp/GNS3VM.VMware.${GNS3VM_VERSION}.zip"