Thomas Vachuska
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
......@@ -22,25 +22,34 @@ function validateIp {
# Parse optional arguments
while [[ $# > 0 ]]; do
case $1 in
case $1 in
clean)
echo "Removing existing karaf, apps, and config directories..."
CLEAN="true"
[ -d $KARAF_ROOT ] && rm -fr $KARAF_ROOT $STAGE/apps $STAGE/config
;;
CLEAN="true";;
secure)
SECURE="true"
;;
SECURE="true";;
*)
break
;;
esac
shift
break;;
esac
shift
done
ONOS_IP=${ONOS_IP:-127.0.0.1}
IP="${1:-$ONOS_IP}"
# If the installed version does not line-up with ONOS_POM_VERSION force clean install
if [ ! -f $KARAF_ROOT/etc/org.apache.karaf.features.cfg ] || \
! grep -q "mvn:org.onosproject/onos-features/$ONOS_POM_VERSION/xml/features" \
$KARAF_ROOT/etc/org.apache.karaf.features.cfg; then
echo "Existing ONOS Karaf uses version different from $ONOS_POM_VERSION; forcing clean install..."
CLEAN="true"
fi
# If clean option was specified, wipe-out existing installation
if [ "$CLEAN" = "true" ]; then
echo "Removing existing ONOS Karaf, apps, and config directories..."
[ -d $KARAF_ROOT ] && rm -fr $KARAF_ROOT $STAGE/apps $STAGE/config
fi
# If IP was not given, nor configured attempt to use ONOS_NIC env. variable
if [ -z "$IP" -a -n "$ONOS_NIC" ]; then
IP=$(validateIp $ONOS_NIC)
......