jw项目windows环境软件安装
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
3.0 KiB

1 year ago
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. setlocal enableextensions
  4. SET params='%*'
  5. SET checkpassword=Y
  6. :loop
  7. FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO (
  8. SET current=%%A
  9. SET params='%%B'
  10. SET silent=N
  11. IF "!current!" == "-s" (
  12. SET silent=Y
  13. )
  14. IF "!current!" == "--silent" (
  15. SET silent=Y
  16. )
  17. IF "!current!" == "-h" (
  18. SET checkpassword=N
  19. )
  20. IF "!current!" == "--help" (
  21. SET checkpassword=N
  22. )
  23. IF "!current!" == "-V" (
  24. SET checkpassword=N
  25. )
  26. IF "!current!" == "--version" (
  27. SET checkpassword=N
  28. )
  29. IF "!silent!" == "Y" (
  30. SET nopauseonerror=Y
  31. ) ELSE (
  32. IF "x!newparams!" NEQ "x" (
  33. SET newparams=!newparams! !current!
  34. ) ELSE (
  35. SET newparams=!current!
  36. )
  37. )
  38. IF "x!params!" NEQ "x" (
  39. GOTO loop
  40. )
  41. )
  42. CALL "%~dp0elasticsearch-env.bat" || exit /b 1
  43. IF ERRORLEVEL 1 (
  44. IF NOT DEFINED nopauseonerror (
  45. PAUSE
  46. )
  47. EXIT /B %ERRORLEVEL%
  48. )
  49. SET KEYSTORE_PASSWORD=
  50. IF "%checkpassword%"=="Y" (
  51. CALL "%~dp0elasticsearch-keystore.bat" has-passwd --silent
  52. IF !ERRORLEVEL! EQU 0 (
  53. SET /P KEYSTORE_PASSWORD=Elasticsearch keystore password:
  54. IF !ERRORLEVEL! NEQ 0 (
  55. ECHO Failed to read keystore password on standard input
  56. EXIT /B !ERRORLEVEL!
  57. )
  58. )
  59. )
  60. if not defined ES_TMPDIR (
  61. for /f "tokens=* usebackq" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.TempDirectory"`) do set ES_TMPDIR=%%a
  62. )
  63. rem The JVM options parser produces the final JVM options to start
  64. rem Elasticsearch. It does this by incorporating JVM options in the following
  65. rem way:
  66. rem - first, system JVM options are applied (these are hardcoded options in
  67. rem the parser)
  68. rem - second, JVM options are read from jvm.options and
  69. rem jvm.options.d/*.options
  70. rem - third, JVM options from ES_JAVA_OPTS are applied
  71. rem - fourth, ergonomic JVM options are applied
  72. @setlocal
  73. for /F "usebackq delims=" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.JvmOptionsParser" "!ES_PATH_CONF!" "!ES_HOME!"/plugins ^|^| echo jvm_options_parser_failed`) do set ES_JAVA_OPTS=%%a
  74. @endlocal & set "MAYBE_JVM_OPTIONS_PARSER_FAILED=%ES_JAVA_OPTS%" & set ES_JAVA_OPTS=%ES_JAVA_OPTS%
  75. if "%MAYBE_JVM_OPTIONS_PARSER_FAILED%" == "jvm_options_parser_failed" (
  76. exit /b 1
  77. )
  78. rem windows batch pipe will choke on special characters in strings
  79. SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^^=^^^^!
  80. SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^&=^^^&!
  81. SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^|=^^^|!
  82. SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^<=^^^<!
  83. SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^>=^^^>!
  84. SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^\=^^^\!
  85. ECHO.!KEYSTORE_PASSWORD!| %JAVA% %ES_JAVA_OPTS% -Delasticsearch ^
  86. -Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" ^
  87. -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
  88. -Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
  89. -Des.bundled_jdk="%ES_BUNDLED_JDK%" ^
  90. -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!
  91. endlocal
  92. endlocal
  93. exit /b %ERRORLEVEL%