blob: a87ff170490cd5883aacbbc31960f6408132d9ea [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
tomdefed6f2014-09-29 11:37:02 -070027 mkdir $ONOS_INSTALL_DIR/config
tom0eaa97f2014-09-22 16:13:06 -070028
tomb41d1ac2014-09-24 01:51:24 -070029 # Install the upstart configuration file and setup options for debugging
tom0eaa97f2014-09-22 16:13:06 -070030 sudo cp $ONOS_INSTALL_DIR/debian/onos.conf /etc/init/onos.conf
tomb41d1ac2014-09-24 01:51:24 -070031 echo 'export ONOS_OPTS=debug' > $ONOS_INSTALL_DIR/options
tom0eaa97f2014-09-22 16:13:06 -070032
tom2d7acb72014-09-22 22:13:00 -070033 # Remove any previous ON.Lab bits from ~/.m2 repo
34 rm -fr ~/.m2/repository/org/onlab
tom5c255702014-09-18 06:57:39 -070035"
tom0768a022014-09-24 16:16:16 -070036
37# Configure the ONOS installation
38onos-config $node
39
40# Ignite the ONOS service.
tom7d197c42014-09-24 16:48:29 -070041onos-service $node start