Jonathan Hart
Committed by Gerrit Code Review

Modify 'onos-setup-karaf clean' to copy package configs

Running onos-setup-karaf clean deletes the karaf directory and any custom configs
you may have put in there. This change allow a developer to put custom configs
in the usual place ($ONOS_ROOT/tools/package/{config,etc}/) and have them copied
automatically to the local Karaf installation.

Change-Id: I9d7feabdee8f8a89930b9955de610dc821d8fdbb
...@@ -23,6 +23,7 @@ function validateIp { ...@@ -23,6 +23,7 @@ function validateIp {
23 # Clean the previous Karaf directory if requested and if it exists. 23 # Clean the previous Karaf directory if requested and if it exists.
24 if [ "$1" = "clean" ]; then 24 if [ "$1" = "clean" ]; then
25 shift 25 shift
26 + CLEAN="true"
26 [ -d $KARAF_ROOT ] && rm -fr $KARAF_ROOT $STAGE/apps $STAGE/config 27 [ -d $KARAF_ROOT ] && rm -fr $KARAF_ROOT $STAGE/apps $STAGE/config
27 fi 28 fi
28 29
...@@ -105,6 +106,12 @@ cat > $STAGE/config/tablets.json <<EOF ...@@ -105,6 +106,12 @@ cat > $STAGE/config/tablets.json <<EOF
105 "partitions": { "p1": [ { "ip": "$IP", "id": "$IP", "tcpPort": 9876 }]}} 106 "partitions": { "p1": [ { "ip": "$IP", "id": "$IP", "tcpPort": 9876 }]}}
106 EOF 107 EOF
107 108
109 +if [ "$CLEAN" = "true" ]; then
110 + echo "Copying package configs..."
111 + cp -r $ONOS_ROOT/tools/package/etc/* $KARAF_ROOT/etc/
112 + cp -r $ONOS_ROOT/tools/package/config/* $STAGE/config/
113 +fi
114 +
108 echo "Staging builtin apps..." 115 echo "Staging builtin apps..."
109 rm -fr $STAGE/apps 116 rm -fr $STAGE/apps
110 onos-stage-apps $STAGE/apps $KARAF_ROOT/system 117 onos-stage-apps $STAGE/apps $KARAF_ROOT/system
......