Be patient when waiting for karaf log

Change-Id: I5f4eca7cd8c4d62e94a510991b03e0193ea503e9
diff --git a/tools/package/onos-run-karaf b/tools/package/onos-run-karaf
index e18e437..cc95df6 100755
--- a/tools/package/onos-run-karaf
+++ b/tools/package/onos-run-karaf
@@ -30,5 +30,15 @@
 echo "$!" > /tmp/onos.pid
 
 # Hang-on a bit and then start tailing the ONOS log output
-sleep 1
-tail -f ./apache*/data/log/karaf.log
+RETRY_COUNT=5
+echo "Waiting for karaf.log"
+until [ $RETRY_COUNT -le 0 ]; do
+    KARAF_LOG=$(find $ONOS_HOME -type f -name karaf.log)
+    if [ $KARAF_LOG ]; then
+        tail -f $KARAF_LOG
+        return
+    fi
+    RETRY_COUNT=$[$RETRY_COUNT-1]
+    sleep 1
+done
+echo "Fail to open karaf.log"
\ No newline at end of file