summaryrefslogtreecommitdiff
path: root/databases/elasticsearch/patches/patch-bin_elasticsearch-env
blob: 8bdaf1266ed11a46b9b22c24f014581a34ede7a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$NetBSD: patch-bin_elasticsearch-env,v 1.1 2017/11/30 17:50:30 fhajny Exp $

Fix default paths.

--- bin/elasticsearch-env.orig	2017-11-10 18:40:01.000000000 +0000
+++ bin/elasticsearch-env
@@ -19,22 +19,17 @@ while [ -h "$SCRIPT" ] ; do
   fi
 done
 
-# 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"`
-done
-ES_HOME=`dirname "$ES_HOME"`
+# hardcode home dir, because we can
+ES_HOME="@ES_BASEDIR@"
 
 # now set the classpath
 ES_CLASSPATH="$ES_HOME/lib/*"
 
+#set default JAVA_HOME
+if [ -z "$JAVA_HOME" ]; then
+  JAVA_HOME="@PKG_JAVA_HOME@"
+fi
+
 # now set the path to java
 if [ -x "$JAVA_HOME/bin/java" ]; then
   JAVA="$JAVA_HOME/bin/java"
@@ -67,7 +62,7 @@ fi
 
 export HOSTNAME=$HOSTNAME
 
-if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi
+if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="@PKG_SYSCONFDIR@"; fi
 
 if [ -z "$ES_PATH_CONF" ]; then
   echo "ES_PATH_CONF must be set to the configuration path"