summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2016-02-09 20:54:20 -0500
committerGerrit Code Review <gerrit@fd.io>2016-02-10 04:24:31 +0000
commitf758a6bf5e3c9cd764c551e76b787e2b7e9736d8 (patch)
treedb284229265c2bad894f36688f4600c02847f12f
parent514939ff19a8838e45934f90af039fbeea12fd40 (diff)
Download karaf tarballs from nexus.fd.io snapshot repo.
Clean up syntax and console output. Change-Id: I06de74d694f309602f612afb71872d2059aa87e9 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rw-r--r--vagrant/bootstrap.ubuntu1404.sh100
1 files changed, 73 insertions, 27 deletions
diff --git a/vagrant/bootstrap.ubuntu1404.sh b/vagrant/bootstrap.ubuntu1404.sh
index 630193892..cc9dfde26 100644
--- a/vagrant/bootstrap.ubuntu1404.sh
+++ b/vagrant/bootstrap.ubuntu1404.sh
@@ -20,12 +20,8 @@ VAGRANT_BASH_ALIASES="$VAGRANT_HOME/.bash_aliases"
VAGRANT_M2_DIR="$VAGRANT_HOME/.m2"
VAGRANT_M2_REPOSITORY="$VAGRANT_M2_DIR/repository"
HONEYCOMB_INSTALL_DIR="/opt/honeycomb"
-V3PO_TARGET_DIR="$HONEYCOMB_MOUNT/v3po/karaf/target"
-V3PO_TARBALL="$KARAF_PACKAGES_MOUNT/v3po-karaf*.tar.gz"
-[ ! -f $V3PO_TARBALL ] && V3PO_TARBALL="$V3PO_TARGET_DIR/v3po-karaf*.tar.gz"
-VBD_TARGET_DIR="$HONEYCOMB_MOUNT/vbd/karaf/target"
-VBD_TARBALL="$KARAF_PACKAGES_MOUNT/vbd-karaf*.tar.gz"
-[ ! -f $VBD_TARBALL ] && VBD_TARBALL="$VBD_TARGET_DIR/vbd-karaf*.tar.gz"
+FDIO_SNAPSHOT_URL="https://nexus.fd.io/content/repositories/fd.io.snapshot"
+FDIO_DEV_URL="http://nexus.fd.io/content/repositories/fd.io.dev/"
# Don't install VPP if this is an ODL VBD application VM
if [ "$VAGRANT_VBD_VM" != "is_vbd_vm" ] ; then
@@ -51,7 +47,7 @@ EOF
# identify the issue. Front and Center!
nr_hugepages=$(cat /proc/sys/vm/nr_hugepages)
echo
- while [ $nr_hugepages != 1024 ] ; do
+ while [ "$nr_hugepages" != "1024" ] ; do
echo -n "Allocating hugepages... "
start hugepages
nr_hugepages=$(cat /proc/sys/vm/nr_hugepages)
@@ -63,15 +59,14 @@ fi
sudo -H -u vagrant perl -i -pe 's/@\\h/@\\\h\$VM_NAME/g' $VAGRANT_BASHRC
sudo -H -u vagrant touch $VAGRANT_BASH_ALIASES
if [ "$VAGRANT_VM_NAME" != "" ] && [ "$(grep VM_NAME $VAGRANT_BASH_ALIASES)" = "" ] ; then
- echo -e "\n# Include VM Name in prompt" >> $VAGRANT_BASH_ALIASES
- echo "export VM_NAME=\"($VAGRANT_VM_NAME)\"" >> $VAGRANT_BASH_ALIASES
+ echo -e "\n# Include VM Name in prompt\nexport VM_NAME=\"($VAGRANT_VM_NAME)\"" >> $VAGRANT_BASH_ALIASES
fi
# Fix grub-pc on Virtualbox with Ubuntu
export DEBIAN_FRONTEND=noninteractive
# Add fd.io apt repo in case its needed
-echo "deb http://nexus.fd.io/content/repositories/fd.io.dev/ ./" > /etc/apt/sources.list.d/99fd.io.list
+echo "deb $FDIO_DEV_URL ./" > /etc/apt/sources.list.d/99fd.io.list
# Standard update + upgrade dance
apt-get update
@@ -105,12 +100,31 @@ export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
EOF
chown vagrant:vagrant $VAGRANT_BASH_ALIASES
fi
-
+source $VAGRANT_BASH_ALIASES
# Use the external Maven M2 repository as a seed if available.
-[ -d /m2-repository ] && sudo -u vagrant sed -i -e 's,/home/vagrant/.m2/repository,/m2-repository,g' /home/vagrant/.m2/settings.xml
+if [ -d "/m2-repository" ] ; then
+ sudo -H -u vagrant sed -i -e 's,/home/vagrant/.m2/repository,/m2-repository,g' /home/vagrant/.m2/settings.xml
+ VAGRANT_M2_REPOSITORY="/m2-repository"
+fi
# Don't install VPP and ODL Honeycomb Agent if this is an ODL VBD application VM
if [ "$VAGRANT_VBD_VM" != "is_vbd_vm" ] ; then
+ # Look for karaf packages
+ if [ -d "$KARAF_PACKAGES_MOUNT" ] ; then
+ V3PO_TARBALL="$(find $KARAF_PACKAGES_MOUNT -name v3po-karaf*.tar.gz | sort | tail -1)"
+ if [ ! -f "$V3PO_TARBALL" ] ; then
+ echo "Fetching latest V3PO tarball from $FDIO_SNAPSHOT_URL"
+ sudo -H -u vagrant mvn dependency:get -DremoteRepositories=$FDIO_SNAPSHOT_URL -DgroupId=io.fd.honeycomb.v3po -DartifactId=v3po-karaf -Dversion=1.0.0-SNAPSHOT -Dpackaging=tar.gz -Dtransitive=false
+ M2_TB_DIR="$VAGRANT_M2_REPOSITORY/io/fd/honeycomb/v3po/v3po-karaf/1.0.0-SNAPSHOT"
+ V3PO_TARBALL="$(find $M2_TB_DIR -name v3po-karaf*.tar.gz | grep -v v3po-karaf-1.0.0-SNAPSHOT | sort | tail -1)"
+ echo "Copying V3PO tarball ($(basename $V3PO_TARBALL)) to $KARAF_PACKAGES_MOUNT"
+ [ -f "$V3PO_TARBALL" ] && cp -p $V3PO_TARBALL $KARAF_PACKAGES_MOUNT
+ V3PO_TARBALL="$(find $KARAF_PACKAGES_MOUNT -name v3po-karaf*.tar.gz | sort | tail -1)"
+ fi
+ else
+ V3PO_TARBALL="$HONEYCOMB_MOUNT/v3po/karaf/target/v3po-karaf*.tar.gz"
+ fi
+
# Disable all ethernet interfaces other than the default route
# interface so VPP will use those interfaces. The VPP auto-blacklist
# algorithm prevents the use of any physical interface contained in the
@@ -120,18 +134,18 @@ if [ "$VAGRANT_VBD_VM" != "is_vbd_vm" ] ; then
if [ "$VAGRANT_VPP_AGENT_ADDR" != "" ] && [ "$(ifconfig $intf | grep $VAGRANT_VPP_AGENT_ADDR)" != "" ] ; then
continue;
fi
- if [ -d /sys/class/net/$intf/device ] && [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then
+ if [ -d "/sys/class/net/$intf/device" ] && [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then
ifconfig $intf down
fi
done
# Install VPP
- if [ -d $VPP_MOUNT ] ; then
+ if [ -d "$VPP_MOUNT" ] ; then
# Fix the silly notion that /bin/sh should point to dash by pointing it to bash
sudo update-alternatives --install /bin/sh sh /bin/bash 100
# Build and install VPP if necessary
- if [ -d $VPP_BUILD_ROOT ] ; then
+ if [ -d "$VPP_BUILD_ROOT" ] ; then
if [ "$(ls $VPP_BUILD_ROOT/*.deb)" = "" ] ; then
echo "Building VPP"
# Bootstrap vpp
@@ -155,42 +169,74 @@ if [ "$VAGRANT_VBD_VM" != "is_vbd_vm" ] ; then
fi
# Build Honeycomb if necessary
- if [ ! -f $V3PO_TARBALL ] ; then
+ if [ ! -f "$V3PO_TARBALL" ] ; then
echo "Building Honeycomb..."
cd $HONEYCOMB_MOUNT
sudo -H -u vagrant mvn clean install -DskipTests
+ V3PO_TARBALL="$HONEYCOMB_MOUNT/v3po/karaf/target/v3po-karaf*.tar.gz"
fi
# Install honeycomb agent (v3po) if available.
- if [ -f $V3PO_TARBALL ] ; then
+ if [ -f "$V3PO_TARBALL" ] ; then
+ V3PO_TARBALL_DIR="$(tar tvf $V3PO_TARBALL | head -1 | awk '{ print $6 }' | cut -d / -f 1)"
+ V3PO_KARAF_DIR="$HONEYCOMB_INSTALL_DIR/$V3PO_TARBALL_DIR"
echo
- echo "Installing Honeycomb VPP agent in $HONEYCOMB_INSTALL_DIR/$V3PO_SNAPSHOT"
- [ ! -d $HONEYCOMB_INSTALL_DIR ] && mkdir -p $HONEYCOMB_INSTALL_DIR
+ echo "Installing Honeycomb VPP agent in $V3PO_KARAF_DIR from $V3PO_TARBALL"
+ [ ! -d "$HONEYCOMB_INSTALL_DIR" ] && mkdir -p $HONEYCOMB_INSTALL_DIR
+ [ -d "$V3PO_KARAF_DIR" ] && rm -rf $V3PO_KARAF_DIR
cd $HONEYCOMB_INSTALL_DIR
- [ -d $V3PO_SNAPSHOT ] && rm -rf $V3PO_SNAPSHOT
- V3PO_KARAF_DIR="$HONEYCOMB_INSTALL_DIR/$(basename $V3PO_TARBALL|perl -pe 's/\.tar.gz//g')"
- [ -d $V3PO_KARAF_DIR ] && rm -rf $V3PO_KARAF_DIR
tar xzf $V3PO_TARBALL
$V3PO_KARAF_DIR/bin/start
+ echo -e "\n\n# Add V3PO karaf bin directory to PATH\nexport PATH=\$PATH:$V3PO_KARAF_DIR/bin" >> $VAGRANT_BASH_ALIASES
+ else
+ echo "WARNING: V3PO Tarball is not available: $V3PO_TARBALL"
fi
+
+# ODL VBD application VM specific installation components
else
+ if [ -d "$KARAF_PACKAGES_MOUNT" ] ; then
+ VBD_TARBALL="$(find $KARAF_PACKAGES_MOUNT -name vbd-karaf*.tar.gz | sort | tail -1)"
+ if [ ! -f "$VBD_TARBALL" ] ; then
+ echo "Fetching latest VBD tarball from $FDIO_SNAPSHOT_URL"
+ sudo -H -u vagrant mvn dependency:get -DremoteRepositories=$FDIO_SNAPSHOT_URL -DgroupId=io.fd.honeycomb.vbd -DartifactId=vbd-karaf -Dversion=1.0.0-SNAPSHOT -Dpackaging=tar.gz -Dtransitive=false
+ M2_TB_DIR="$VAGRANT_M2_REPOSITORY/io/fd/honeycomb/vbd/vbd-karaf/1.0.0-SNAPSHOT"
+ VBD_TARBALL="$(find $M2_TB_DIR -name vbd-karaf*.tar.gz | grep -v vbd-karaf-1.0.0-SNAPSHOT | sort | tail -1)"
+ echo "Copying VBD tarball ($(basename $VBD_TARBALL)) to $KARAF_PACKAGES_MOUNT"
+ [ -f "$VBD_TARBALL" ] && cp -p $VBD_TARBALL $KARAF_PACKAGES_MOUNT
+ VBD_TARBALL="$(find $KARAF_PACKAGES_MOUNT -name vbd-karaf*.tar.gz | sort | tail -1)"
+ fi
+ else
+ VBD_TARBALL="$HONEYCOMB_MOUNT/vbd/karaf/target/vbd-karaf*.tar.gz"
+ fi
+
# Build Honeycomb if necessary
- if [ ! -f $VBD_TARBALL ] ; then
+ if [ ! -f "$VBD_TARBALL" ] ; then
echo "Building Honeycomb..."
cd $HONEYCOMB_MOUNT
sudo -H -u vagrant mvn clean install -DskipTests
+ VBD_TARBALL="$HONEYCOMB_MOUNT/vbd/karaf/target/vbd-karaf*.tar.gz"
fi
# Install ODL Virtual Bridge Domain App if available.
- if [ -f $VBD_TARBALL ] ; then
+ if [ -f "$VBD_TARBALL" ] ; then
+ VBD_TARBALL_DIR="$(tar tvf $VBD_TARBALL | head -1 | awk '{ print $6 }' | cut -d / -f 1)"
+ VBD_KARAF_DIR="$HONEYCOMB_INSTALL_DIR/$VBD_TARBALL_DIR"
echo
echo "Installing ODL Virtual Bridge Domain application in $HONEYCOMB_INSTALL_DIR/$VBD_SNAPSHOT"
- [ ! -d $HONEYCOMB_INSTALL_DIR ] && mkdir -p $HONEYCOMB_INSTALL_DIR
+ [ ! -d "$HONEYCOMB_INSTALL_DIR" ] && mkdir -p $HONEYCOMB_INSTALL_DIR
+ [ -d "$VBD_KARAF_DIR" ] && rm -rf $VBD_KARAF_DIR
cd $HONEYCOMB_INSTALL_DIR
- VBD_KARAF_DIR="$HONEYCOMB_INSTALL_DIR/$(basename $VBD_TARBALL|perl -pe 's/\.tar.gz//g')"
- [ -d $VBD_KARAF_DIR ] && rm -rf $VBD_KARAF_DIR
tar xzf $VBD_TARBALL
$VBD_KARAF_DIR/bin/start
+ echo -e "\n\n# Add VBD karaf bin directory to PATH\nexport PATH=\$PATH:$VBD_KARAF_DIR/bin" >> $VAGRANT_BASH_ALIASES
+ else
+ echo "WARNING: VBD tarball is not available: $VBD_TARBALL"
fi
+
+ # Install google chrome browser for ODL YANGUI
+ cd /opt
+ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
+ sudo dpkg -i google-chrome-stable_current_amd64.deb
+ sudo apt-get install -fy
fi
echo "VM Installation Complete!"