From 4b7b23cf208ae7173cdb839e9a23dbae4fdb0b79 Mon Sep 17 00:00:00 2001 From: Gregory Gee Date: Tue, 25 Feb 2014 23:15:03 -0500 Subject: [PATCH] Change the installation to a separate option as recommended with -V. This argument expect a parameter which is the version number of OVS you wish to install. install.sh -V 2.0.0 What is nice that I tested, is that you can keep running the above to change which OVS version you want to test with. Also, if a new version of OVS is released, just run the above again specifying the new version number. The version number must match the version number in the tarball file name like openvswitch-2.0.0.tar.gz. In this case, the version specified must be 2.0.0. --- util/install.sh | 65 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/util/install.sh b/util/install.sh index 6aa6960..f295803 100755 --- a/util/install.sh +++ b/util/install.sh @@ -264,6 +264,64 @@ function wireshark { } +# Install Open vSwitch specific version Ubuntu package +function ubuntuOvs { + echo "Creating and Installing Open vSwitch packages..." + + OVS_SRC=$BUILD_DIR/openvswitch + OVS_TARBALL_LOC=http://openvswitch.org/releases + + if [ "$DIST" = "Ubuntu" ] && [ `expr $RELEASE '>=' 12.04` = 1 ]; then + rm -rf $OVS_SRC + mkdir -p $OVS_SRC + cd $OVS_SRC + + if wget $OVS_TARBALL_LOC/openvswitch-$OVS_RELEASE.tar.gz 2> /dev/null; then + tar xzf openvswitch-$OVS_RELEASE.tar.gz + else + echo "Failed to find OVS at $OVS_TARBALL_LOC/openvswitch-$OVS_RELEASE.tar.gz" + cd $BUILD_DIR + return + fi + + # Remove any old packages + $remove openvswitch-common openvswitch-datapath-dkms openvswitch-controller \ + openvswitch-pki openvswitch-switch + + # Get build deps + $install build-essential fakeroot debhelper autoconf automake libssl-dev \ + pkg-config bzip2 openssl python-all procps python-qt4 \ + python-zopeinterface python-twisted-conch dkms + + # Build OVS + cd $BUILD_DIR/openvswitch/openvswitch-$OVS_RELEASE + DEB_BUILD_OPTIONS='parallel=2 nocheck' fakeroot debian/rules binary + cd .. + $pkginst openvswitch-common_$OVS_RELEASE*.deb openvswitch-datapath-dkms_$OVS_RELEASE*.deb \ + openvswitch-pki_$OVS_RELEASE*.deb openvswitch-switch_$OVS_RELEASE*.deb + if $pkginst openvswitch-controller_$OVS_RELEASE*.deb; then + echo "Ignoring error installing openvswitch-controller" + fi + + modinfo openvswitch + sudo ovs-vsctl show + # Switch can run on its own, but + # Mininet should control the controller + # This appears to only be an issue on Ubuntu/Debian + if sudo service openvswitch-controller stop; then + echo "Stopped running controller" + fi + if [ -e /etc/init.d/openvswitch-controller ]; then + sudo update-rc.d openvswitch-controller disable + fi + else + echo "Failed to install Open vSwitch. OS must be Ubuntu >= 12.04" + cd $BUILD_DIR + return + fi +} + + # Install Open vSwitch function ovs { @@ -596,7 +654,7 @@ function vm_clean { } function usage { - printf '\nUsage: %s [-abcdfhikmnprtvwx03]\n\n' $(basename $0) >&2 + printf '\nUsage: %s [-abcdfhikmnprtvVwx03]\n\n' $(basename $0) >&2 printf 'This install script attempts to install useful packages\n' >&2 printf 'for Mininet. It should (hopefully) work on Ubuntu 11.10+\n' >&2 @@ -621,6 +679,7 @@ function usage { printf -- ' -s : place dependency (S)ource/build trees in \n' >&2 printf -- ' -t: complete o(T)her Mininet VM setup tasks\n' >&2 printf -- ' -v: install Open (V)switch\n' >&2 + printf -- ' -V : install a particular version of Open (V)switch on Ubuntu\n' >&2 printf -- ' -w: install OpenFlow (W)ireshark dissector\n' >&2 printf -- ' -x: install NO(X) Classic OpenFlow controller\n' >&2 printf -- ' -0: (default) -0[fx] installs OpenFlow 1.0 versions\n' >&2 @@ -634,7 +693,7 @@ if [ $# -eq 0 ] then all else - while getopts 'abcdefhikmnprs:tvwx03' OPTION + while getopts 'abcdefhikmnprs:tvV:wx03' OPTION do case $OPTION in a) all;; @@ -659,6 +718,8 @@ else echo "Dependency installation directory: $BUILD_DIR";; t) vm_other;; v) ovs;; + V) OVS_RELEASE=$OPTARG; + ubuntuOvs;; w) wireshark;; x) case $OF_VERSION in 1.0) nox;;