Committed by
Gerrit Code Review
Allowing buck-based onos run to run with or without 'clean' option.
Change-Id: If6f9e584b82c60ff0b85d3931352354c375c49cb
Showing
1 changed file
with
31 additions
and
23 deletions
| ... | @@ -12,30 +12,38 @@ cd /tmp | ... | @@ -12,30 +12,38 @@ cd /tmp |
| 12 | 12 | ||
| 13 | set -e | 13 | set -e |
| 14 | 14 | ||
| 15 | -# Blitz previously unrolled onos- directory | 15 | +ONOS_DIR=$(tar tf $ONOS_TAR | head -n 1 | cut -d/ -f1) |
| 16 | -rm -fr onos-*/ | 16 | + |
| 17 | - | 17 | +if [ -d $ONOS_DIR -a "$1" = "clean" ]; then |
| 18 | -# Unroll new image from the specified tar file | 18 | + # Blitz previously unrolled onos- directory |
| 19 | -[ -f $ONOS_TAR ] && tar zxf $ONOS_TAR | 19 | + rm -fr $ONOS_DIR |
| 20 | - | 20 | + |
| 21 | -# Change into the ONOS home directory | 21 | + # Unroll new image from the specified tar file |
| 22 | -cd onos-*/ | 22 | + [ -f $ONOS_TAR ] && tar zxf $ONOS_TAR |
| 23 | -export ONOS_HOME=$PWD | 23 | + |
| 24 | - | 24 | + # Change into the ONOS home directory |
| 25 | -# FIXME: for now we're running using the karaf client; later use raw SSH | 25 | + cd $ONOS_DIR |
| 26 | -unset ONOS_USE_SSH | 26 | + export ONOS_HOME=$PWD |
| 27 | - | 27 | + |
| 28 | -# Create config/cluster.json (cluster metadata) | 28 | + # FIXME: for now we're running using the karaf client; later use raw SSH |
| 29 | -IP=${ONOS_IP:-127.0.0.1} | 29 | + unset ONOS_USE_SSH |
| 30 | -echo "Creating local cluster configs for IP $IP..." | 30 | + |
| 31 | -[ -d $ONOS_HOME/config ] || mkdir -p $ONOS_HOME/config | 31 | + # Create config/cluster.json (cluster metadata) |
| 32 | -cat > $ONOS_HOME/config/cluster.json <<EOF | 32 | + IP=${ONOS_IP:-127.0.0.1} |
| 33 | -{ | 33 | + echo "Creating local cluster configs for IP $IP..." |
| 34 | - "name": "default", | 34 | + [ -d $ONOS_HOME/config ] || mkdir -p $ONOS_HOME/config |
| 35 | - "nodes": [ {"id": "$IP", "ip": "$IP", "port": 9876 } ], | 35 | + cat > $ONOS_HOME/config/cluster.json <<-EOF |
| 36 | - "partitions": [ { "id": 1, "members": [ "$IP" ] } ] | 36 | + { |
| 37 | -} | 37 | + "name": "default", |
| 38 | + "nodes": [ {"id": "$IP", "ip": "$IP", "port": 9876 } ], | ||
| 39 | + "partitions": [ { "id": 1, "members": [ "$IP" ] } ] | ||
| 40 | + } | ||
| 38 | EOF | 41 | EOF |
| 42 | +else | ||
| 43 | + # Change into the ONOS home directory | ||
| 44 | + cd $ONOS_DIR | ||
| 45 | + export ONOS_HOME=$PWD | ||
| 46 | +fi | ||
| 39 | 47 | ||
| 40 | # Start ONOS as a server, but include any specified options | 48 | # Start ONOS as a server, but include any specified options |
| 41 | ./bin/onos-service server "$@" &>onos.log & | 49 | ./bin/onos-service server "$@" &>onos.log & | ... | ... |
-
Please register or login to post a comment