Committed by
Gerrit Code Review
Enhancing onos-setup-karaf to automatically force clean run when it detects disc…
…repancy in ONOS version. Change-Id: I5c271d68a884930652d0d46a62f4c8ef31e08124
Showing
1 changed file
with
20 additions
and
11 deletions
| ... | @@ -22,25 +22,34 @@ function validateIp { | ... | @@ -22,25 +22,34 @@ function validateIp { |
| 22 | 22 | ||
| 23 | # Parse optional arguments | 23 | # Parse optional arguments |
| 24 | while [[ $# > 0 ]]; do | 24 | while [[ $# > 0 ]]; do |
| 25 | -case $1 in | 25 | + case $1 in |
| 26 | clean) | 26 | clean) |
| 27 | - echo "Removing existing karaf, apps, and config directories..." | 27 | + CLEAN="true";; |
| 28 | - CLEAN="true" | ||
| 29 | - [ -d $KARAF_ROOT ] && rm -fr $KARAF_ROOT $STAGE/apps $STAGE/config | ||
| 30 | - ;; | ||
| 31 | secure) | 28 | secure) |
| 32 | - SECURE="true" | 29 | + SECURE="true";; |
| 33 | - ;; | ||
| 34 | *) | 30 | *) |
| 35 | - break | 31 | + break;; |
| 36 | - ;; | 32 | + esac |
| 37 | -esac | 33 | + shift |
| 38 | -shift | ||
| 39 | done | 34 | done |
| 40 | 35 | ||
| 41 | ONOS_IP=${ONOS_IP:-127.0.0.1} | 36 | ONOS_IP=${ONOS_IP:-127.0.0.1} |
| 42 | IP="${1:-$ONOS_IP}" | 37 | IP="${1:-$ONOS_IP}" |
| 43 | 38 | ||
| 39 | +# If the installed version does not line-up with ONOS_POM_VERSION force clean install | ||
| 40 | +if [ ! -f $KARAF_ROOT/etc/org.apache.karaf.features.cfg ] || \ | ||
| 41 | + ! grep -q "mvn:org.onosproject/onos-features/$ONOS_POM_VERSION/xml/features" \ | ||
| 42 | + $KARAF_ROOT/etc/org.apache.karaf.features.cfg; then | ||
| 43 | + echo "Existing ONOS Karaf uses version different from $ONOS_POM_VERSION; forcing clean install..." | ||
| 44 | + CLEAN="true" | ||
| 45 | +fi | ||
| 46 | + | ||
| 47 | +# If clean option was specified, wipe-out existing installation | ||
| 48 | +if [ "$CLEAN" = "true" ]; then | ||
| 49 | + echo "Removing existing ONOS Karaf, apps, and config directories..." | ||
| 50 | + [ -d $KARAF_ROOT ] && rm -fr $KARAF_ROOT $STAGE/apps $STAGE/config | ||
| 51 | +fi | ||
| 52 | + | ||
| 44 | # If IP was not given, nor configured attempt to use ONOS_NIC env. variable | 53 | # If IP was not given, nor configured attempt to use ONOS_NIC env. variable |
| 45 | if [ -z "$IP" -a -n "$ONOS_NIC" ]; then | 54 | if [ -z "$IP" -a -n "$ONOS_NIC" ]; then |
| 46 | IP=$(validateIp $ONOS_NIC) | 55 | IP=$(validateIp $ONOS_NIC) | ... | ... |
-
Please register or login to post a comment