--- bin/elasticsearch-env
+++ bin/elasticsearch-env 2019-05-09 13:57:05.000000000 -0400
-# determine Elasticsearch home; to do this, we strip from the path until we find
-# bin, and then strip bin (there is an assumption here that there is no nested
-# directory under bin also named bin)
-ES_HOME=`dirname "$SCRIPT"`
-# now make ES_HOME absolute
-ES_HOME=`cd "$ES_HOME"; pwd`
-while [ "`basename "$ES_HOME"`" != "bin" ]; do
- ES_HOME=`dirname "$ES_HOME"`
-ES_HOME=`dirname "$ES_HOME"`
+ES_HOME="@PREFIX@/share/elasticsearch"
+ES_PATH_CONF="@PREFIX@/etc/elasticsearch"
ES_CLASSPATH="$ES_HOME/lib/*"
# now set the path to java
+if [ -z "$JAVA_HOME" ]; then
+ if [ -x /usr/libexec/java_home ]; then
+ export JAVA_HOME=$(/usr/libexec/java_home)
+ export KEYTOOL="$JAVA_HOME"/jre/bin
if [ ! -z "$JAVA_HOME" ]; then
JAVA="$JAVA_HOME/bin/java"
- if [ "$(uname -s)" = "Darwin" ]; then
- # OSX has a different structure
- JAVA="$ES_HOME/jdk/Contents/Home/bin/java"
- JAVA="$ES_HOME/jdk/bin/java"
+# MacPorts' port:elasticsearch includes port:openjdk13 as a dependency;
+# no need to include this bundled Elasticsearch copy of OpenJDK13
+## if [ "$(uname -s)" = "Darwin" ]; then
+## # OSX has a different structure
+## JAVA="$ES_HOME/jdk/Contents/Home/bin/java"
+## JAVA="$ES_HOME/jdk/bin/java"
if [ ! -x "$JAVA" ]; then
export HOSTNAME=$HOSTNAME
-if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi
if [ -z "$ES_PATH_CONF" ]; then
echo "ES_PATH_CONF must be set to the configuration path"