Patching Apache Karaf with a shell console fix to avoid thread leak.

Change-Id: I27e8fbaf443391a51b40c35639a39a5f38aecf31
diff --git a/tools/package/BUCK b/tools/package/BUCK
index 05fefcb..a317983 100644
--- a/tools/package/BUCK
+++ b/tools/package/BUCK
@@ -1,5 +1,6 @@
 KARAF = '//lib:apache-karaf'
 BRANDING = '//tools/package/branding:onos-tools-package-branding'
+PATCHES = '//lib:apache-karaf-patches'
 
 FEATURES = [
   '//features:onos-thirdparty-base',
@@ -21,8 +22,8 @@
 genrule(
   name = 'onos-karaf',
   srcs = glob(['bin/*', 'etc/*', 'init/*', 'runtime/bin/*']),
-  bash = '$(location :onos-prep-karaf) $OUT $(location %s) %s $(location %s)'\
-            % (KARAF, ONOS_VERSION, BRANDING),
+  bash = '$(location :onos-prep-karaf) $OUT $(location %s) %s $(location %s) $(location %s)'\
+            % (KARAF, ONOS_VERSION, BRANDING, PATCHES),
   out = 'karaf.zip',
 )
 
diff --git a/tools/package/onos-prep-karaf b/tools/package/onos-prep-karaf
index ed89fb2..49488b0 100755
--- a/tools/package/onos-prep-karaf
+++ b/tools/package/onos-prep-karaf
@@ -9,6 +9,7 @@
 KARAF_TAR=$2
 ONOS_VERSION=$3
 BRANDING=$4
+KARAF_PATCHES=$5
 #FIXME karaf version
 KARAF_VERSION="3.0.8"
 ONOS_SECURITY_MODE="false"
@@ -17,6 +18,7 @@
 
 # Unroll the Apache Karaf bits, prune them and make ONOS top-level directories.
 tar xf $KARAF_TAR
+tar xf $KARAF_PATCHES
 
 # Unroll the Apache Karaf bits, prune them and make ONOS top-level directories.
 KARAF_DIR=$(ls -d apache*)