blob: d594105f1b659705e3eda69e7b355bb062359209 [file] [log] [blame]
tom5c255702014-09-18 06:57:39 -07001#!/bin/bash
2#-------------------------------------------------------------------------------
tom1a2908c2014-09-23 16:37:39 -07003# Remotely pushes bits to a remote node and installs ONOS on it.
tom5c255702014-09-18 06:57:39 -07004#-------------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
tom3014aef2014-09-18 08:44:39 -07009# If the first option is -f attempt uninstall first.
tom5ca34372014-09-19 17:43:41 -070010[ "$1" = "-f" ] && shift && onos-uninstall ${1:-$OCI}
tom3014aef2014-09-18 08:44:39 -070011
tom0768a022014-09-24 16:16:16 -070012node=${1:-$OCI}
13remote=$ONOS_USER@$node
tom5c255702014-09-18 06:57:39 -070014
tom3014aef2014-09-18 08:44:39 -070015scp -q $ONOS_TAR $remote:/tmp
tom5c255702014-09-18 06:57:39 -070016
tom3014aef2014-09-18 08:44:39 -070017ssh $remote "
18 [ -d $ONOS_INSTALL_DIR/bin ] && echo \"ONOS is already installed\" && exit 1
19
tom1f3805d2014-09-18 19:58:47 -070020 # Prepare a landing zone and unroll the bits
tom3014aef2014-09-18 08:44:39 -070021 sudo mkdir -p $ONOS_INSTALL_DIR && sudo chown sdn:sdn $ONOS_INSTALL_DIR
tom5c255702014-09-18 06:57:39 -070022 tar zxmf /tmp/$ONOS_BITS.tar.gz -C $ONOS_INSTALL_DIR --strip-components=1
23
tom0eaa97f2014-09-22 16:13:06 -070024 # Make a link to the log file directory and make a home for auxiliaries
tomecd0fbd2014-09-19 08:47:05 -070025 ln -s $ONOS_INSTALL_DIR/$KARAF_DIST/data/log /opt/onos/log
tom0eaa97f2014-09-22 16:13:06 -070026 mkdir $ONOS_INSTALL_DIR/var
27
tomb41d1ac2014-09-24 01:51:24 -070028 # Install the upstart configuration file and setup options for debugging
tom0eaa97f2014-09-22 16:13:06 -070029 sudo cp $ONOS_INSTALL_DIR/debian/onos.conf /etc/init/onos.conf
tomb41d1ac2014-09-24 01:51:24 -070030 echo 'export ONOS_OPTS=debug' > $ONOS_INSTALL_DIR/options
tom0eaa97f2014-09-22 16:13:06 -070031
tom2d7acb72014-09-22 22:13:00 -070032 # Remove any previous ON.Lab bits from ~/.m2 repo
33 rm -fr ~/.m2/repository/org/onlab
tom5c255702014-09-18 06:57:39 -070034"
tom0768a022014-09-24 16:16:16 -070035
36# Configure the ONOS installation
37onos-config $node
38
39# Ignite the ONOS service.
tom7d197c42014-09-24 16:48:29 -070040onos-service $node start