Skip to content

Commit

Permalink
Retrive JVM_VERSION from Logstash's home directory (elastic#14797)
Browse files Browse the repository at this point in the history
Updates bootscripts common part to retrieve the JVM_VERSION file from the Logstash home directory
  • Loading branch information
andsel authored Jan 12, 2023
1 parent a7027dc commit 6bbe070
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bin/logstash.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ setup_java() {
if [ -x "$LS_JAVA_HOME/bin/java" ]; then
JAVACMD="$LS_JAVA_HOME/bin/java"
if [ -d "${LOGSTASH_HOME}/${BUNDLED_JDK_PART}" -a -x "${LOGSTASH_HOME}/${BUNDLED_JDK_PART}/bin/java" ]; then
BUNDLED_JDK_VERSION=`cat JDK_VERSION`
if [ ! -e "${LOGSTASH_HOME}/JDK_VERSION" ]; then
echo "File ${LOGSTASH_HOME}/JDK_VERSION doesn't exists"
exit 1
fi
BUNDLED_JDK_VERSION=`cat "${LOGSTASH_HOME}/JDK_VERSION"`
echo "WARNING: Logstash comes bundled with the recommended JDK(${BUNDLED_JDK_VERSION}), but is overridden by the version defined in LS_JAVA_HOME. Consider clearing LS_JAVA_HOME to use the bundled JDK."
fi
else
Expand Down
6 changes: 5 additions & 1 deletion bin/setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ if defined LS_JAVA_HOME (
set JAVACMD=%LS_JAVA_HOME%\bin\java.exe
echo Using LS_JAVA_HOME defined java: %LS_JAVA_HOME%
if exist "%LS_HOME%\jdk" (
set /p BUNDLED_JDK_VERSION=<JDK_VERSION
if not exist "%LS_HOME%\JDK_VERSION" (
echo "File %LS_HOME%\JDK_VERSION doesn't exists"
exit /b 1
)
set /p BUNDLED_JDK_VERSION=<"%LS_HOME%\JDK_VERSION"
echo "WARNING: Logstash comes bundled with the recommended JDK(%BUNDLED_JDK_VERSION%), but is overridden by the version defined in LS_JAVA_HOME. Consider clearing LS_JAVA_HOME to use the bundled JDK."
)
) else (
Expand Down

0 comments on commit 6bbe070

Please sign in to comment.