-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy patheclair-node.bat
More file actions
192 lines (156 loc) · 6.19 KB
/
eclair-node.bat
File metadata and controls
192 lines (156 loc) · 6.19 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
@REM Copyright (c) 2012, Joshua Suereth
@REM All rights reserved.
@REM
@REM Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@REM
@REM Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
@REM Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
@REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@REM @@APP_NAME@@ launcher script
@REM
@REM Environment:
@REM JAVA_HOME - location of a JDK home dir (optional if java on path)
@REM CFG_OPTS - JVM options (optional)
@REM Configuration:
@REM @@APP_ENV_NAME@@_config.txt found in the @@APP_ENV_NAME@@_HOME.
@setlocal enabledelayedexpansion
@setlocal enableextensions
@echo off
if "%@@APP_ENV_NAME@@_HOME%"=="" (
set "APP_HOME=%~dp0\\.."
rem Also set the old env name for backwards compatibility
set "@@APP_ENV_NAME@@_HOME=%~dp0\\.."
) else (
set "APP_HOME=%@@APP_ENV_NAME@@_HOME%"
)
set "APP_LIB_DIR=%APP_HOME%\lib\"
rem Detect if we were double clicked, although theoretically A user could
rem manually run cmd /c
for %%x in (!cmdcmdline!) do if %%~x==/c set DOUBLECLICKED=1
rem FIRST we load the config file of extra options.
set "CFG_FILE=%APP_HOME%\@@APP_ENV_NAME@@_config.txt"
set CFG_OPTS=
call :parse_config "%CFG_FILE%" CFG_OPTS
rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
set _JAVA_OPTS=%JAVA_OPTS%
if "!_JAVA_OPTS!"=="" set _JAVA_OPTS=!CFG_OPTS!
rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments
rem "-J" is stripped, "-D" is left as is, and everything is appended to JAVA_OPTS
set _JAVA_PARAMS=
set _APP_ARGS=
for /f %%i in ('dir /b %APP_LIB_DIR%\eclair-node*') do set APP_ENTRYPOINT=%%i
set CUSTOM_MAIN_CLASS="fr.acinq.eclair.Boot"
set APP_CLASSPATH="%APP_LIB_DIR%;%APP_LIB_DIR%/%APP_ENTRYPOINT%"
rem Bundled JRE has priority over standard environment variables
if defined BUNDLED_JVM (
set "_JAVACMD=%BUNDLED_JVM%\bin\java.exe"
) else (
if "%JAVACMD%" neq "" (
set "_JAVACMD=%JAVACMD%"
) else (
if "%JAVA_HOME%" neq "" (
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
)
)
)
if "%_JAVACMD%"=="" set _JAVACMD=java
rem Detect if this java is ok to use.
for /F %%j in ('"%_JAVACMD%" -version 2^>^&1') do (
if %%~j==java set JAVAINSTALLED=1
if %%~j==openjdk set JAVAINSTALLED=1
)
rem BAT has no logical or, so we do it OLD SCHOOL! Oppan Redmond Style
set JAVAOK=true
if not defined JAVAINSTALLED set JAVAOK=false
if "%JAVAOK%"=="false" (
echo.
echo A Java JDK is not installed or can't be found.
if not "%JAVA_HOME%"=="" (
echo JAVA_HOME = "%JAVA_HOME%"
)
echo.
echo Please go to
echo https://adoptium.net/temurin/releases/?package=jdk&version=21
echo and download a valid Java JDK and install before running @@APP_NAME@@.
echo.
echo If you think this message is in error, please check
echo your environment variables to see if "java.exe" and "javac.exe" are
echo available via JAVA_HOME or PATH.
echo.
if defined DOUBLECLICKED pause
exit /B 1
)
rem if configuration files exist, prepend their contents to the script arguments so it can be processed by this runner
call :parse_config "%SCRIPT_CONF_FILE%" SCRIPT_CONF_ARGS
call :process_args %SCRIPT_CONF_ARGS% %%*
set _JAVA_OPTS=!_JAVA_OPTS! !_JAVA_PARAMS!
if defined CUSTOM_MAIN_CLASS (
set MAIN_CLASS=!CUSTOM_MAIN_CLASS!
) else (
set MAIN_CLASS=!APP_MAIN_CLASS!
)
rem Call the application and pass all arguments unchanged.
"%_JAVACMD%" !_JAVA_OPTS! !@@APP_ENV_NAME@@_OPTS! -cp %APP_CLASSPATH% %MAIN_CLASS% !_APP_ARGS!
@endlocal
exit /B %ERRORLEVEL%
rem Loads a configuration file full of default command line options for this script.
rem First argument is the path to the config file.
rem Second argument is the name of the environment variable to write to.
:parse_config
set _PARSE_FILE=%~1
set _PARSE_OUT=
if exist "%_PARSE_FILE%" (
FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%_PARSE_FILE%") DO (
set _PARSE_OUT=!_PARSE_OUT! %%i
)
)
set %2=!_PARSE_OUT!
exit /B 0
:add_java
set _JAVA_PARAMS=!_JAVA_PARAMS! %*
exit /B 0
:add_app
set _APP_ARGS=!_APP_ARGS! %*
exit /B 0
rem Processes incoming arguments and places them in appropriate global variables
:process_args
:param_loop
call set _PARAM1=%%1
set "_TEST_PARAM=%~1"
if ["!_PARAM1!"]==[""] goto param_afterloop
rem ignore arguments that do not start with '-'
if "%_TEST_PARAM:~0,1%"=="-" goto param_java_check
set _APP_ARGS=!_APP_ARGS! !_PARAM1!
shift
goto param_loop
:param_java_check
if "!_TEST_PARAM:~0,2!"=="-J" (
rem strip -J prefix
set _JAVA_PARAMS=!_JAVA_PARAMS! !_TEST_PARAM:~2!
shift
goto param_loop
)
if "!_TEST_PARAM:~0,2!"=="-D" (
rem test if this was double-quoted property "-Dprop=42"
for /F "delims== tokens=1,*" %%G in ("!_TEST_PARAM!") DO (
if not ["%%H"] == [""] (
set _JAVA_PARAMS=!_JAVA_PARAMS! !_PARAM1!
) else if [%2] neq [] (
rem it was a normal property: -Dprop=42 or -Drop="42"
call set _PARAM1=%%1=%%2
set _JAVA_PARAMS=!_JAVA_PARAMS! !_PARAM1!
shift
)
)
) else (
if "!_TEST_PARAM!"=="-main" (
call set CUSTOM_MAIN_CLASS=%%2
shift
) else (
set _APP_ARGS=!_APP_ARGS! !_PARAM1!
)
)
shift
goto param_loop
:param_afterloop
exit /B 0