From: Ed Warnicke Date: Thu, 22 Aug 2013 19:24:39 +0000 (-0500) Subject: Fixed run.sh to autodetect JAVA_HOME on Mac OS X X-Git-Tag: releasepom-0.1.0~180^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=9d3f0e86700273bf0fefc261e128f6e419827451 Fixed run.sh to autodetect JAVA_HOME on Mac OS X Change-Id: I3043d19a90f90258883a870d65acd8c26698e3e1 Signed-off-by: Ed Warnicke --- diff --git a/opendaylight/distribution/opendaylight/src/main/resources/run.sh b/opendaylight/distribution/opendaylight/src/main/resources/run.sh index 313b3b2c79..2587a5d2ab 100755 --- a/opendaylight/distribution/opendaylight/src/main/resources/run.sh +++ b/opendaylight/distribution/opendaylight/src/main/resources/run.sh @@ -1,9 +1,5 @@ #!/bin/bash -[[ -z ${JAVA_HOME} ]] && echo "Need to set JAVA_HOME environment variable" && exit -1; -[[ ! -x ${JAVA_HOME}/bin/java ]] && echo "Cannot find an executable \ -JVM at path ${JAVA_HOME}/bin/java check your JAVA_HOME" && exit -1; - platform='unknown' unamestr=`uname` if [[ "$unamestr" == 'Linux' ]]; then @@ -32,8 +28,15 @@ elif [[ $platform == 'osx' ]]; then PHYS_DIR=`pwd -P` RESULT=$PHYS_DIR/$TARGET_FILE fullpath=$RESULT + + [[ -z ${JAVA_HOME} ]] && [[ -x "/usr/libexec/java_home" ]] && export JAVA_HOME=`/usr/libexec/java_home -v 1.7`; + fi +[[ -z ${JAVA_HOME} ]] && echo "Need to set JAVA_HOME environment variable" && exit -1; +[[ ! -x ${JAVA_HOME}/bin/java ]] && echo "Cannot find an executable \ +JVM at path ${JAVA_HOME}/bin/java check your JAVA_HOME" && exit -1; + basedir=`dirname ${fullpath}` function usage {