1 # set default route to be the GATEWAY
2 declare -r GATEWAY=${1:-}
3 # set default gateway for bridged interface, and make it happen at reboot
4 if [[ -n "${GATEWAY}" ]]; then
5 echo "Setting default gateway through bridged interface"
6 ip route delete default 2>&1 >/dev/null || true
7 ip route add default via ${GATEWAY}
8 echo "GATEWAY=${GATEWAY}" >/etc/default/vagrant-bridge
9 [ -r /vagrant/vagrant-bridge.conf ] && cp /vagrant/vagrant-bridge.conf /etc/init/ # symlinks don't work
10 initctl reload-configuration
13 # Fix grub-pc on Virtualbox with Ubuntu
14 export DEBIAN_FRONTEND=noninteractive
16 # Standard update + upgrade dance
20 # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
22 sudo update-alternatives --install /bin/sh sh /bin/bash 100
25 apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs libganglia1-dev libapr1-dev libconfuse-dev
28 # apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
31 apt-get install -y linux-image-extra-`uname -r`
33 # Install jdk and maven
34 apt-get install -y openjdk-7-jdk
35 mkdir /usr/local/apache-maven
36 cd /usr/local/apache-maven
37 wget http://apache.go-parts.com/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
38 tar -xzvf apache-maven-3.3.9-bin.tar.gz -C /usr/local/apache-maven/
39 update-alternatives --install /usr/bin/mvn mvn /usr/local/apache-maven/apache-maven-3.3.9/bin/mvn 1
40 update-alternatives --config mvn
42 sudo -H -u vagrant mkdir .m2
43 sudo -H -u vagrant cp /honeycomb/vagrant/settings.xml .m2
45 cat << EOF > .bash_aliases
46 export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
47 export MAVEN_OPTS="-Xms256m -Xmx512m" # Very important to put the "m" on the end
48 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
50 chown vagrant:vagrant .bash_aliases
52 # Use the external Maven M2 repository if it has been mounted on /m2-repository
53 [ -d /m2-repository ] && sudo -u vagrant sed -i -e 's,/home/vagrant/.m2/repository,/m2-repository,g' /home/vagrant/.m2/settings.xml
55 # Setup for hugepages using upstart so it persists across reboots
56 echo "vm.nr_hugepages=1024" >> /etc/sysctl.d/20-hugepages.conf
59 cat << EOF > /etc/init/hugepages.conf
60 start on runlevel [2345]
65 mkdir -p /run/hugepages/kvm || true
66 rm -f /run/hugepages/kvm/* || true
67 rm -f /dev/shm/* || true
68 mount -t hugetlbfs nodev /run/hugepages/kvm
72 # Make sure we run that hugepages.conf right now
78 sudo -u vagrant mkdir git
81 # Check if git exists and remove it before attempting clone, else clone ineffective when "reload --provision"
82 [ -d honeycomb ] && rm -rf honeycomb
83 sudo -H -u vagrant git clone /honeycomb
86 # Initial honeycomb build
87 sudo -H -u vagrant mvn clean install -DskipTests
89 # Install honeycomb agent (v3po)
90 mkdir -p /opt/honeycomb/v3po
91 cp -a v3po/karaf /opt/honeycomb/v3po
93 # Install ODL Virtual Bridge App
95 cp -a vbd/karaf /opt/odl/vbd
100 # Check if git exists and remove it before attempting clone, else clone ineffective when "reload --provision"
101 [ -d vpp ] && rm -rf vpp
102 sudo -H -u vagrant git clone /vpp
106 if [ -d build-root ]; then
109 sudo -H -u vagrant ./bootstrap.sh
112 sudo -H -u vagrant make V=0 PLATFORM=vpp TAG=vpp_debug install-deb
114 # Install debian packages
117 # Disable all ethernet interfaces other than the default route
118 # so VPP will use those interfaces.
119 for intf in $(ls /sys/class/net) ; do
120 if [ -d /sys/class/net/$intf/device ] && [ "$(route | grep default | grep $intf)" == "" ] ; then