blob: 4d425c63c032376284cdfeb6329838a97bc27669 [file] [log] [blame]
Thomas Vachuska52e65802014-12-08 09:26:01 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Remotely pushes bits to a remote node in preparation for install.
4# -----------------------------------------------------------------------------
Ayaka Koshibef17f34a2015-09-24 19:31:48 -07005function _usage () {
6cat << _EOF_
7usage:
8 $(basename $0) [node]
9
10options:
11- [node] : the target node to prime for installation
12
13summary:
14 Remotely pushes bits to a remote node in preparation for install.
15
16 $(basename $0) is invoked as part of 'onos-install', and shouldn't be
17 directly invoked for the most part.
18
19_EOF_
20}
21
22[ "$1" = "-h" ] && _usage && exit 0
Thomas Vachuska52e65802014-12-08 09:26:01 -080023
24[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
25. $ONOS_ROOT/tools/build/envDefaults
26
27node=${1:-$OCI}
28remote=$ONOS_USER@$node
29
30locHash=$(cksum $ONOS_TAR | cut -d' ' -f1,2)
Jonathan Hart520f2272015-01-15 16:06:32 -080031remHash=$(ssh $remote cksum $ONOS_TAR 2>/dev/null | cut -d' ' -f1,2)
Thomas Vachuska52e65802014-12-08 09:26:01 -080032
33if [ "$locHash" = "$remHash" ]; then
34 echo "ONOS bits $ONOS_TAR already up-to-date on $node..."
35else
36 scp -q $ONOS_TAR $remote:/tmp
37fi