Add safer empty variable checking for Windows
We need to check if JAVA_TOOL_OPTIONS, and JAVA_OPTS are set, and if ES_PATH_CONF is not set. However, if these variables are defined and contain quotes, the current mechanism busts on them. Instead, we should use safer mechanism for checking if these variable are defined or not. This commit does that. Relates #26268
This commit is contained in:
parent
542fe864f8
commit
65c353350a
|
@ -29,14 +29,14 @@ if not exist %JAVA% (
|
|||
)
|
||||
|
||||
rem do not let JAVA_TOOL_OPTIONS slip in (as the JVM does by default)
|
||||
if not "%JAVA_TOOL_OPTIONS%" == "" (
|
||||
if defined JAVA_TOOL_OPTIONS (
|
||||
echo warning: ignoring JAVA_TOOL_OPTIONS=%JAVA_TOOL_OPTIONS%
|
||||
set JAVA_TOOL_OPTIONS=
|
||||
)
|
||||
|
||||
rem JAVA_OPTS is not a built-in JVM mechanism but some people think it is so we
|
||||
rem warn them that we are not observing the value of %JAVA_OPTS%
|
||||
if not "%JAVA_OPTS%" == "" (
|
||||
if defined JAVA_OPTS (
|
||||
(echo|set /p=warning: ignoring JAVA_OPTS=%JAVA_OPTS%; )
|
||||
echo pass JVM parameters via ES_JAVA_OPTS
|
||||
)
|
||||
|
@ -46,6 +46,6 @@ rem check the Java version
|
|||
|
||||
set HOSTNAME=%COMPUTERNAME%
|
||||
|
||||
if "%ES_PATH_CONF%" == "" (
|
||||
if not defined ES_PATH_CONF (
|
||||
set ES_PATH_CONF=!ES_HOME!\config
|
||||
)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
setlocal enableextensions
|
||||
|
||||
call "%~dp0elasticsearch-env.bat" || exit /b 1
|
||||
|
||||
|
@ -13,3 +14,4 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1
|
|||
%*
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
setlocal enableextensions
|
||||
|
||||
call "%~dp0elasticsearch-env.bat" || exit /b 1
|
||||
|
||||
|
@ -13,3 +14,4 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1
|
|||
%*
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
setlocal enableextensions
|
||||
|
||||
call "%~dp0elasticsearch-env.bat" || exit /b 1
|
||||
|
||||
|
@ -266,3 +267,4 @@ set "%~2=%conv%"
|
|||
goto:eof
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
setlocal enableextensions
|
||||
|
||||
call "%~dp0elasticsearch-env.bat" || exit /b 1
|
||||
|
||||
|
@ -13,3 +14,4 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1
|
|||
%*
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
setlocal enableextensions
|
||||
|
||||
SET params='%*'
|
||||
|
||||
|
@ -51,3 +52,4 @@ for /F "usebackq delims=" %%a in (`findstr /b \- "%ES_JVM_OPTIONS%"`) do set JVM
|
|||
%JAVA% %ES_JAVA_OPTS% -Delasticsearch -Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
|
Loading…
Reference in New Issue