[ONOS-3553] Resolve the onos-service not start issue

This commit resolves onos-service not start issue.
If we have onos directory under /opt, no matter the directory
is empty or not, onos-service always tries to use this path.
If onos-service binary located in other path, we need to
reconfigure the ONOS_HOME.

Change-Id: I13f375d75e864240e6d014100fb7b69de7fd4178
diff --git a/tools/package/bin/onos-service b/tools/package/bin/onos-service
index 2f00ca0..5cc2009 100755
--- a/tools/package/bin/onos-service
+++ b/tools/package/bin/onos-service
@@ -13,6 +13,15 @@
 ONOS_HOME=/opt/onos
 KARAF_ARGS=
 SYS_APPS=drivers
+CURRENT_ONOS_HOME="`( cd $(dirname $0)/.. && pwd )`"
+
+# check whether executable onos binary is located under /opt/onos
+# if not try to reconfigure ONOS_HOME with current path
+if [ $CURRENT_ONOS_HOME != $ONOS_HOME ]; then
+    ONOS_HOME=$CURRENT_ONOS_HOME
+fi
+
+echo $ONOS_HOME
 
 [ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..