Align ONOS_HOME detection
- Detect default ONOS_HOME in a same way as onos.sh.
- export detected path to be used by child scripts.
Change-Id: Ic44fd18d63acd5906a8cc9dc8a45f15f51d31477
diff --git a/build-ramcloud-java-bindings.sh b/build-ramcloud-java-bindings.sh
index 3e3e48d..8237bd6 100755
--- a/build-ramcloud-java-bindings.sh
+++ b/build-ramcloud-java-bindings.sh
@@ -4,8 +4,8 @@
set -x
-ONOS_HOME=${ONOS_HOME:-~/ONOS}
-RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
+export ONOS_HOME=${ONOS_HOME:-$(cd `dirname $0`; pwd)}
+export RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
${ONOS_HOME}/ramcloud-build-scripts/build_jni_so.sh
diff --git a/ramcloud-build-scripts/build_jni_so.sh b/ramcloud-build-scripts/build_jni_so.sh
index bd4be1e..0d39716 100755
--- a/ramcloud-build-scripts/build_jni_so.sh
+++ b/ramcloud-build-scripts/build_jni_so.sh
@@ -18,8 +18,8 @@
set -x
JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-oracle}
-ONOS_HOME=${ONOS_HOME:-~/ONOS}
-RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
+export ONOS_HOME=${ONOS_HOME:-$(cd `dirname $0`; cd ..; pwd)}
+export RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
RAMCLOUD_BRANCH=${RAMCLOUD_BRANCH:-master}
mvn -f ${ONOS_HOME}/pom.xml compile -T 1C
diff --git a/setup-ramcloud.sh b/setup-ramcloud.sh
index 77cca18..c374833 100755
--- a/setup-ramcloud.sh
+++ b/setup-ramcloud.sh
@@ -5,8 +5,8 @@
# echo back each command
set -x
-ONOS_HOME=${ONOS_HOME:-~/ONOS}
-RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
+export ONOS_HOME=${ONOS_HOME:-$(cd `dirname $0`; pwd)}
+export RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
if [ -d ${RAMCLOUD_HOME} ]; then
echo "${RAMCLOUD_HOME} already exist, please rename or remove them."