blob: b2707048d71708c6de224e85b63c3e85b830d961 [file] [log] [blame]
tom5c255702014-09-18 06:57:39 -07001#!/bin/bash
2#-------------------------------------------------------------------------------
tom5ca34372014-09-19 17:43:41 -07003# Remotely pushes bits to a remote machine and installs ONOS.
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
tom5c255702014-09-18 06:57:39 -070012remote=$ONOS_USER@${1:-$OCI}
13
tom3014aef2014-09-18 08:44:39 -070014scp -q $ONOS_TAR $remote:/tmp
tom5c255702014-09-18 06:57:39 -070015
tom3014aef2014-09-18 08:44:39 -070016ssh $remote "
17 [ -d $ONOS_INSTALL_DIR/bin ] && echo \"ONOS is already installed\" && exit 1
18
tom1f3805d2014-09-18 19:58:47 -070019 # Prepare a landing zone and unroll the bits
tom3014aef2014-09-18 08:44:39 -070020 sudo mkdir -p $ONOS_INSTALL_DIR && sudo chown sdn:sdn $ONOS_INSTALL_DIR
tom5c255702014-09-18 06:57:39 -070021 tar zxmf /tmp/$ONOS_BITS.tar.gz -C $ONOS_INSTALL_DIR --strip-components=1
22
tom0eaa97f2014-09-22 16:13:06 -070023 # Make a link to the log file directory and make a home for auxiliaries
tomecd0fbd2014-09-19 08:47:05 -070024 ln -s $ONOS_INSTALL_DIR/$KARAF_DIST/data/log /opt/onos/log
tom0eaa97f2014-09-22 16:13:06 -070025 mkdir $ONOS_INSTALL_DIR/var
26
27 # Install the upstart configuration file.
28 sudo cp $ONOS_INSTALL_DIR/debian/onos.conf /etc/init/onos.conf
29
tom2d7acb72014-09-22 22:13:00 -070030 # Remove any previous ON.Lab bits from ~/.m2 repo
31 rm -fr ~/.m2/repository/org/onlab
32
tom0eaa97f2014-09-22 16:13:06 -070033 # Ignite the ONOS service.
34 sudo service onos start
tom5c255702014-09-18 06:57:39 -070035"