blob: 39565413439090bb59d8b51930369f0ba141ab1d [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
tom1f3805d2014-09-18 19:58:47 -070023 # Make a link to the log file directory.
tomecd0fbd2014-09-19 08:47:05 -070024 ln -s $ONOS_INSTALL_DIR/$KARAF_DIST/data/log /opt/onos/log
tom5c255702014-09-18 06:57:39 -070025"