Thomas Vachuska | 52e6580 | 2014-12-08 09:26:01 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Remotely pushes bits to a remote node in preparation for install. |
| 4 | # ----------------------------------------------------------------------------- |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 5 | function _usage () { |
| 6 | cat << _EOF_ |
| 7 | usage: |
| 8 | $(basename $0) [node] |
| 9 | |
| 10 | options: |
| 11 | - [node] : the target node to prime for installation |
| 12 | |
| 13 | summary: |
| 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 Vachuska | 52e6580 | 2014-12-08 09:26:01 -0800 | [diff] [blame] | 23 | |
| 24 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 25 | . $ONOS_ROOT/tools/build/envDefaults |
| 26 | |
| 27 | node=${1:-$OCI} |
| 28 | remote=$ONOS_USER@$node |
| 29 | |
| 30 | locHash=$(cksum $ONOS_TAR | cut -d' ' -f1,2) |
Jonathan Hart | 520f227 | 2015-01-15 16:06:32 -0800 | [diff] [blame] | 31 | remHash=$(ssh $remote cksum $ONOS_TAR 2>/dev/null | cut -d' ' -f1,2) |
Thomas Vachuska | 52e6580 | 2014-12-08 09:26:01 -0800 | [diff] [blame] | 32 | |
| 33 | if [ "$locHash" = "$remHash" ]; then |
| 34 | echo "ONOS bits $ONOS_TAR already up-to-date on $node..." |
| 35 | else |
| 36 | scp -q $ONOS_TAR $remote:/tmp |
| 37 | fi |