FreeBSD Java support (#1014)

Signed-off-by: hackacad <admin@hackacad.net>
This commit is contained in:
Sven R 2021-09-08 00:17:58 +02:00 committed by GitHub
parent 83332c8ab6
commit 268d93b375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -6,6 +6,15 @@ CDPATH=""
SCRIPT="$0"
UNAME=$(uname -s)
if [ $UNAME = "FreeBSD" ]; then
OS="freebsd"
elif [ $UNAME = "Darwin" ]; then
OS="darwin"
else
OS="other"
fi
# SCRIPT might be an arbitrarily deep series of symbolic links; loop until we
# have the concrete path
while [ -h "$SCRIPT" ] ; do
@ -40,9 +49,12 @@ if [ ! -z "$JAVA_HOME" ]; then
JAVA="$JAVA_HOME/bin/java"
JAVA_TYPE="JAVA_HOME"
else
if [ "$(uname -s)" = "Darwin" ]; then
# macOS has a different structure
if [ $OS = "darwin" ]; then
# macOS bundled Java
JAVA="$OPENSEARCH_HOME/jdk.app/Contents/Home/bin/java"
elif [ $OS = "freebsd" ]; then
# using FreeBSD default java from ports if JAVA_HOME is not set
JAVA="/usr/local/bin/java"
else
JAVA="$OPENSEARCH_HOME/jdk/bin/java"
fi