blob: babfdefaaabdd832283353c35fa860c3edbda99a [file] [log] [blame]
tom5c255702014-09-18 06:57:39 -07001#!/bin/bash
2#-------------------------------------------------------------------------------
tom3014aef2014-09-18 08:44:39 -07003# Remotely pushes bits to a remote machine and install & starts 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.
10[ "$1" = "-f" ] && shift && onos-uninstall ${1:-$OCI}
11
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
19 sudo mkdir -p $ONOS_INSTALL_DIR && sudo chown sdn:sdn $ONOS_INSTALL_DIR
tom5c255702014-09-18 06:57:39 -070020 tar zxmf /tmp/$ONOS_BITS.tar.gz -C $ONOS_INSTALL_DIR --strip-components=1
21
tom3014aef2014-09-18 08:44:39 -070022 ln -s /opt/onos/$KARAF_DIST/data/log /opt/onos/log
23
tom5c255702014-09-18 06:57:39 -070024"