tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
tom | 3014aef | 2014-09-18 08:44:39 -0700 | [diff] [blame] | 3 | # Remotely pushes bits to a remote machine and install & starts ONOS. |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame] | 4 | #------------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | |
tom | 3014aef | 2014-09-18 08:44:39 -0700 | [diff] [blame] | 9 | # If the first option is -f attempt uninstall first. |
| 10 | [ "$1" = "-f" ] && shift && onos-uninstall ${1:-$OCI} |
| 11 | |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame] | 12 | remote=$ONOS_USER@${1:-$OCI} |
| 13 | |
tom | 3014aef | 2014-09-18 08:44:39 -0700 | [diff] [blame] | 14 | scp -q $ONOS_TAR $remote:/tmp |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame] | 15 | |
tom | 3014aef | 2014-09-18 08:44:39 -0700 | [diff] [blame] | 16 | ssh $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 |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame] | 20 | tar zxmf /tmp/$ONOS_BITS.tar.gz -C $ONOS_INSTALL_DIR --strip-components=1 |
| 21 | |
tom | 3014aef | 2014-09-18 08:44:39 -0700 | [diff] [blame] | 22 | ln -s /opt/onos/$KARAF_DIST/data/log /opt/onos/log |
| 23 | |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame] | 24 | " |