Use offline version of karaf 4.2.1

Change-Id: Ie3e42bd5768702c1d38df70f9c6fdf65a697635d
diff --git a/tools/build/build-offline-karaf b/tools/build/build-offline-karaf
index baaec33..24d5821 100755
--- a/tools/build/build-offline-karaf
+++ b/tools/build/build-offline-karaf
@@ -1,12 +1,13 @@
 #!/bin/bash
  
 KARAF_VERSION="4.2.1"
+KARAF_BASE_PACKAGE_VERSION="4.2.1-20181024"
 KARAF_TARFILE_NAME="apache-karaf-${KARAF_VERSION}.tar"
-BOOT_FEATURES="standard,ssh,scr,war,webconsole"
+ADDED_BOOT_FEATURES="kar/${KARAF_VERSION},webconsole/${KARAF_VERSION},scr/${KARAF_VERSION},war/${KARAF_VERSION}"
 
 # fetch the standard karaf bits
 rm -f /tmp/${KARAF_TARFILE_NAME}
-curl -o /tmp/${KARAF_TARFILE_NAME}.gz http://onlab.vicci.org/onos/third-party/${KARAF_TARFILE_NAME}.gz
+curl -o /tmp/${KARAF_TARFILE_NAME}.gz http://repo1.maven.org/maven2/org/onosproject/apache-karaf-offline/${KARAF_BASE_PACKAGE_VERSION}/apache-karaf-offline-${KARAF_BASE_PACKAGE_VERSION}.tar.gz
 
 # get a small cell
 source ${ONOS_ROOT}/tools/dev/bash_profile
@@ -21,13 +22,13 @@
     cd karaf
     tar xf /tmp/${KARAF_TARFILE_NAME}.gz
 
-    # set the ONOS default boot features
-    perl -pi.old -e 's|^(featuresBoot=).*|\1${BOOT_FEATURES}|' apache-karaf-${KARAF_VERSION}/etc/org.apache.karaf.features.cfg
+    # add the extra ONOS default boot features
+    sed -i.old -e 's|kar/${KARAF_VERSION}.*$|${ADDED_BOOT_FEATURES}|' apache-karaf-${KARAF_VERSION}/etc/org.apache.karaf.features.cfg
 
     # run karaf to fill the maven repo with required artifacts
     apache-karaf-${KARAF_VERSION}/bin/karaf server 1>/tmp/onos.out 2>/tmp/onos.err &
 
-    sleep 15
+    sleep 30
 
     # stop karaf and capture the artifacts that were downloaded into the maven repo
     apache-karaf-${KARAF_VERSION}/bin/karaf stop 1>/tmp/onos.out 2>/tmp/onos.err &
@@ -51,7 +52,7 @@
 "
 
 # fetch the new offline karaf tar ball
-BUILD_NUMBER="apache-karaf-${KARAF_VERSION}-offline-$(date +'%Y%m%d')"
+BUILD_NUMBER="${KARAF_VERSION}-offline-$(date +'%Y%m%d')"
 scp sdn@[${OC1}]:karaf-offline.tar.gz /tmp/${BUILD_NUMBER}.tar.gz
 
 cell return