blob: 9e17c76272086183e6881c8b617e139fcd132b24 [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
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.
tom3014aef2014-09-18 08:44:39 -070024 ln -s /opt/onos/$KARAF_DIST/data/log /opt/onos/log
tom1f3805d2014-09-18 19:58:47 -070025
26 # TODO: Setup ONOS to run as a daemon; for now we at least startup
27 nohup /opt/onos/bin/onos-ctl server </dev/null 1>/opt/onos/svc.log 2>&1 &
tom5c255702014-09-18 06:57:39 -070028"