blob: 2c20f4a5994d3b583529e6d89c2733082621b155 [file] [log] [blame]
#!/bin/bash
# -----------------------------------------------------------------------------
# Remotely pushes bits to a remote node and installs ONOS on it.
# -----------------------------------------------------------------------------
function _usage () {
cat << _EOF_
usage:
$(basename $0) [-fn] [-m] <settings> [node]
options:
- [node] : remote node to install ONOS on.
summary:
Downloads Atomix bits to a remote node and installs Atomix on it.
The -u should be used on upstart-based systems.
If [node] is not specified the default target is \$OCI.
_EOF_
}
[ "$1" = "-h" ] && _usage && exit 0
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
onos-check-bits
while getopts fnvm: o; do
case "$o" in
f) uninstall=true;;
n) nostart=true;;
esac
done
let OPC=$OPTIND-1
shift $OPC
# If the -f was given, attempt uninstall first.
[ -n "$uninstall" ] && atomix-uninstall ${1:-$OCI}
node=${1:-$OCI}
remote=$ONOS_USER@$node
ssh -tt $remote "
[ -f $ATOMIX_INSTALL_DIR/bin/atomix-agent ] && echo \"Atomix is already installed\" && exit 1
sudo mkdir -p $ATOMIX_INSTALL_DIR && sudo chown ${ONOS_USER}:${ONOS_GROUP} $ATOMIX_INSTALL_DIR
sudo wget -O $ATOMIX_INSTALL_DIR/atomix-dist.tar.gz https://oss.sonatype.org/content/repositories/releases/io/atomix/atomix-dist/3.0.0-rc12/atomix-dist-3.0.0-rc12.tar.gz
tar -xvf $ATOMIX_INSTALL_DIR/atomix-dist.tar.gz -C $ATOMIX_INSTALL_DIR
"
# Configure the ONOS installation
atomix-config $node
# Upload the shared cluster key if present
[ -f "$ONOS_CLUSTER_KEY_FILE" ] && onos-push-cluster-key $1
# Unless -n option was given, attempt to ignite the ONOS service.
[ -z "$nostart" ] && atomix-service $node start || true