Skip to content

Commit

Permalink
Merge branch 'unstable'
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-duponchelle committed Aug 31, 2015
2 parents 876f51a + dda9189 commit d460512
Show file tree
Hide file tree
Showing 12 changed files with 191 additions and 31 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ Run:
./virtualbox.sh
```

Output is located here: *output-virtualbox-ovf/gns3.ova*

This step will build the base VM as an OVA without install gns3 on it.

If you want to install GNS3 you need to unzip the OVA and run:
```
./release_virtualbox.sh GNS3\ VM.ova 1.4.0
```

### VmWare

Expand All @@ -36,3 +42,11 @@ Run:

For exporting to OVA you need to install:
https://my.vmware.com/web/vmware/details?downloadGroup=OVFTOOL400&productId=353


This step will build the base VM as an OVA without install gns3 on it.

If you want to install GNS3 you need to unzip the OVA and run:
```
./release_vmware.sh GNS3\ VM.ova 1.4.0
```
3 changes: 0 additions & 3 deletions config/gns3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ console log


script
if [ ! -f /usr/local/bin/gns3server ]; then
curl https://raw.githubusercontent.com/GNS3/gns3-vm/master/scripts/initial_setup.sh | bash
fi
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/gns3.pid --chuid gns3 --exec "/usr/local/bin/gns3server"
end script

Expand Down
4 changes: 2 additions & 2 deletions config/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Welcome to GNS3 appliance
VM version: $(cat /home/gns3/.config/GNS3/gns3vm_version)
Please wait the end of installation.
The VM will reboot at the end.
GNS3 is not installed please install it with sudo pip3 install gns3-server
$(kvm-ok)
EOF
Expand Down
4 changes: 0 additions & 4 deletions gns3.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@
{
"script" : "scripts/cleaner.sh",
"type" : "shell"
},
{
"type" : "shell",
"inline" : "sudo pip3 install gns3-server=={{user `gns3_version`}}"
}
],
"builders" : [
Expand Down
78 changes: 78 additions & 0 deletions gns3_release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"variables" : {
"ssh_pass" : "gns3",
"ssh_name" : "gns3",
"gns3_version": "{{env `GNS3_VERSION`}}"
"gns3_src": "{{env `GNS3_SRC`}}"
},
"provisioners" : [
{
"inline": "sudo rm -rf /tmp/*",
"type": "shell"
},
{
"inline" : "sudo pip3 install gns3-server=={{user `gns3_version`}}",
"type" : "shell"
}
],
"builders" : [
{
"type": "vmware-vmx",
"vm_name" : "GNS3 VM",
"headless": true,
"source_path": "{{user `gns3_src`}}",
"ssh_username": "{{user `ssh_name`}}",
"ssh_password": "{{user `ssh_pass`}}",
"shutdown_command" : "echo {{user `ssh_name`}} | sudo -S shutdown -P now",
"vmx_data" :
{
"ethernet0.connectionType": "nat"
},
"vmx_data_post":
{
"ethernet0.connectionType": "hostonly"
}
},
{
"type": "virtualbox-ovf",
"vm_name" : "GNS3 VM",
"headless": true,
"source_path": "{{user `gns3_src`}}",
"ssh_username": "{{user `ssh_name`}}",
"ssh_password": "{{user `ssh_pass`}}",
"shutdown_command" : "echo {{user `ssh_name`}} | sudo -S shutdown -P now",
"vmx_data" :
{
"ethernet0.connectionType": "nat"
},
"vboxmanage" : [
[
"modifyvm",
"{{.Name}}",
"--nic1",
"nat"
]
],
"vboxmanage_post" : [
[
"modifyvm",
"{{.Name}}",
"--nic1",
"hostonly"
],
[
"modifyvm",
"{{.Name}}",
"--nictype1",
"82540EM"
],
[
"modifyvm",
"{{.Name}}",
"--hostonlyadapter1",
"vboxnet0"
]
],
}
]
}
33 changes: 33 additions & 0 deletions release_virtualbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# This script take a VM and install GNS3 server on it
#
# You need to pass the GNS3 VM OVA as parameter and GNS3 version as second parameter
#

set -e


export PATH=$PATH:/Applications/VMware\ OVF\ Tool/
export GNS3_VERSION=`echo $2 | sed "s/^v//"`

if [ "$GNS3_VERSION" == "" ]
then
echo "You need to pass the GNS3 version as parameter"
exit 1
fi


echo "Build VM for GNS3 $GNS3_VERSION"

rm -Rf output-*
export GNS3_SRC=$1
packer build -only=virtualbox-ovf gns3_release.json

cd output-vmware-vmx

zip -9 "../GNS3 VM VirtualBox ${GNS3_VERSION}.zip" "GNS3 VM.ova"

cd ..
rm -Rf output-*

42 changes: 42 additions & 0 deletions release_vmware.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
#
# This script take a VM and install GNS3 server on it
#
# You need to pass the GNS3 VM OVA as parameter
#

set -e




export PATH=$PATH:/Applications/VMware\ OVF\ Tool/
export GNS3_VERSION=`echo $2 | sed "s/^v//"`

if [ "$GNS3_VERSION" == "" ]
then
echo "You need to pass the GNS3 version as parameter"
exit 1
fi



echo "Build VM for GNS3 $GNS3_VERSION"

rm -Rf output-vmx
mkdir output-vmx
ovftool --allowAllExtraConfig "$1" output-vmx/gns3.vmx

rm -Rf output-vmware-vmx
export GNS3_SRC="output-vmx/gns3.vmx"
packer build -only=vmware-vmx gns3_release.json

cd output-vmware-vmx

ovftool --allowAllExtraConfig "GNS3 VM.vmx" "GNS3 VM.ova"

zip -9 "../GNS3 VM VMware ${GNS3_VERSION}.zip" "GNS3 VM.ova"

cd ..
rm -Rf output-*

1 change: 1 addition & 0 deletions scripts/cleaner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ sudo mv /etc/rc0.d/K61zerofree /etc/rc0.d/S61zerofree
sudo mv /etc/rc6.d/K61zerofree /etc/rc6.d/S61zerofree
sudo touch /zerofree

sudo rm -rf /tmp/*
4 changes: 3 additions & 1 deletion scripts/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ then
sudo chown root:root /etc/default/grub
sudo update-grub

sudo apt-get install -y qemu-system-arm
sudo apt-get install -y qemu-system-arm

echo -n '0.9.0' > .config/GNS3/gns3vm_version
fi
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.6
0.9.0
14 changes: 6 additions & 8 deletions virtualbox.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#!/bin/bash

#
# This script build the VM without the GNS3 server installed
#
set -e

if [ "$GNS3_VERSION" == "" ]
then
echo "You need to export the GNS3_VERSION variable if you want to build the VM. Example export GNS3_VERSION=1.4.0"
exit 1
fi
export GNS3_VERSION=`echo $GNS3_VERSION | sed "s/^v//"` 

export GNS3VM_VERSION=`cat version`

echo "Build VM $GNS3VM_VERSION"
Expand All @@ -17,3 +12,6 @@ packer build -force -only=virtualbox-iso $* gns3.json

cd output-virtualbox-iso
zip -9 "../GNS3 VM VirtualBox ${GNS3VM_VERSION}.zip" "GNS3 VM.ova"

rm -Rf output-*

21 changes: 10 additions & 11 deletions vmware.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
#!/bin/bash
#
# This script build the VM without the GNS3 server installed
#

set -e


if [ "$GNS3_VERSION" == "" ]
then
echo "You need to export the GNS3_VERSION variable if you want to build the VM. Example export GNS3_VERSION=1.4.0"
exit 1
fi

export PATH=$PATH:/Applications/VMware\ OVF\ Tool/

export GNS3_VERSION=`echo $GNS3_VERSION | sed "s/^v//"`
export GNS3VM_VERSION=`cat version`

echo "Build VM $GNS3VM_VERSION for GNS3 $GNS3_VERSION"
echo "Build VM $GNS3VM_VERSION"

rm -Rf output-vmware-iso
packer build -only=vmware-iso gns3.json

rm -Rf output-vmware-ova
mkdir output-vmware-ova

#Packer bug on post_vmx in 0.8.x we apply a second time the settings to the OVA
# Packer bug on post_vmx in 0.8.x we apply a second time the settings to the OVA
# Also we force export to remove the CD ROM
ovftool \
--extraConfig:vhv.enable=true \
--extraConfig:hypervisor.cpuid.v0=false \
--extraConfig:ethernet0.connectionType=hostonly \
--extraConfig:ethernet1.present=true \
--extraConfig:ethernet1.startConnected=true \
Expand All @@ -35,7 +30,11 @@ ovftool \
--extraConfig:ethernet1.wakeOnPcktRcv=false \
--extraConfig:ethernet1.pciSlotNumber=33 \
--allowAllExtraConfig \
--noImageFiles \
--overwrite output-vmware-iso/GNS3\ VM.vmx output-vmware-ova/GNS3\ VM.ova

cd output-vmware-ova
zip -9 "../GNS3 VM VMware ${GNS3VM_VERSION}.zip" "GNS3 VM.ova"

rm -Rf output-*

0 comments on commit d460512

Please sign in to comment.