Added support to pre-stage apps as part of onos-setup-karaf.
Fixed onos-app reinstall command usage.
Change-Id: I1f5eb084a06fb16f7b2db7b61376211c25c4327a
diff --git a/tools/test/bin/onos-setup-karaf b/tools/test/bin/onos-setup-karaf
index 7cd75a9..930fdf7 100755
--- a/tools/test/bin/onos-setup-karaf
+++ b/tools/test/bin/onos-setup-karaf
@@ -70,9 +70,9 @@
$KARAF_ROOT/lib
fi
-if [ ! -d $STAGE/apps -o ! -d $STAGE/config ]; then
+if [ ! -d $STAGE/config ]; then
echo "Creating local cluster configs for IP $IP..."
- mkdir -p $STAGE/apps $STAGE/config
+ mkdir -p $STAGE/config
cat > $STAGE/config/cluster.json <<EOF
{ "ipPrefix": "$SUBNET.*",
"nodes":[ { "id": "$IP", "ip": "$IP", "tcpPort": 9876 }]}
@@ -88,3 +88,20 @@
cp $ONOS_ROOT/tools/package/etc/hazelcast.xml $KARAF_ROOT/etc/hazelcast.xml
perl -pi.old -e "s/192.168.56/$SUBNET/" $KARAF_ROOT/etc/hazelcast.xml
perl -pi.old -e "s/ <name>onos</ <name>$IP</" $KARAF_ROOT/etc/hazelcast.xml
+
+
+echo "Staging builtin apps..."
+rm -fr $STAGE/apps
+mkdir -p $STAGE/apps
+find $ONOS_ROOT -name 'app.xml' | egrep -v '/src/test/|/target/|org\.foo\.' | \
+ xargs grep 'name=' | sed 's/<app name="//g;s/".*//g' | while read line; do
+ appxml=${line%:*}
+ app=${line#*:}
+ mkdir $STAGE/apps/$app
+ cp $appxml $STAGE/apps/$app/app.xml
+ done
+
+echo "Customizing apps to be auto-activated..."
+for app in $(echo $ONOS_APPS | tr ',' ' '); do
+ touch $STAGE/apps/org.onosproject.$app/active
+done