blob: d999f36325068a092db896f32e895e2d3c8184e3 [file] [log] [blame]
tom5c255702014-09-18 06:57:39 -07001#!/bin/bash
Pavlin Radoslavov91413792014-10-15 11:00:32 -07002# -----------------------------------------------------------------------------
tom1a2908c2014-09-23 16:37:39 -07003# Remotely pushes bits to a remote node and installs ONOS on it.
Pavlin Radoslavov91413792014-10-15 11:00:32 -07004# -----------------------------------------------------------------------------
tom5c255702014-09-18 06:57:39 -07005
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
Pavlin Radoslavov3c4d3412014-10-15 10:22:52 -070021 sudo mkdir -p $ONOS_INSTALL_DIR && sudo chown ${ONOS_USER}:${ONOS_USER} $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
tom9ccb2512014-10-07 12:54:53 -070035
36 # Drop log level for the console
37 echo "log4j.logger.org.apache.sshd = WARN" >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg
38
tom5c255702014-09-18 06:57:39 -070039"
tom0768a022014-09-24 16:16:16 -070040
41# Configure the ONOS installation
42onos-config $node
43
44# Ignite the ONOS service.
tom7d197c42014-09-24 16:48:29 -070045onos-service $node start