diff options
Diffstat (limited to 'priv/templates/extended_bin_windows')
-rw-r--r-- | priv/templates/extended_bin_windows | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/priv/templates/extended_bin_windows b/priv/templates/extended_bin_windows index 6d8f084..16e3d96 100644 --- a/priv/templates/extended_bin_windows +++ b/priv/templates/extended_bin_windows @@ -37,17 +37,18 @@ @set vm_args=%rel_dir%\vm.args @set progname=erl.exe @set clean_boot_script=%release_root_dir%\bin\start_clean -@set erlsrv="%bindir%\erlsrv.exe" -@set epmd="%bindir%\epmd.exe" -@set escript="%bindir%\escript.exe" -@set werl="%bindir%\werl.exe" -@set nodetool="%release_root_dir%\bin\nodetool" +@set "erlsrv=%bindir%\erlsrv.exe" +@set "epmd=%bindir%\epmd.exe" +@set "escript=%bindir%\escript.exe" +@set "werl=%bindir%\werl.exe" +@set "erl=%bindir%\erl.exe" +@set "nodetool=%release_root_dir%\bin\nodetool" @set "extensions0={{ extensions }}" @set "extensions1=%extensions0:|= %" @set "extensions=%extensions1: undefined=%" :: Extract node type and name from vm.args -@for /f "usebackq tokens=1-2" %%I in (`findstr /b "\-name \-sname" "%vm_args%"`) do @( +@for /f "usebackq tokens=1-2" %%I in ('findstr /b "\-name \-sname" "%vm_args%"') do @( set node_type=%%I set node_name=%%J ) @@ -76,9 +77,18 @@ set "hostname=@%hostname%" ) -:: Extract cookie from vm.args -@for /f "usebackq tokens=1-2" %%I in (`findstr /b \-setcookie "%vm_args%"`) do @( - set cookie=%%J +:: Extract the target cookie +:: Do this before relx_get_nodename so we can use it and not create a ~/.erlang.cookie +@for /f "usebackq tokens=1-2" %%I in ('findstr /b \-setcookie "%vm_args%"') do @( + set "cookie=%%J" +) +@set "default_cookie_file=%USERPROFILE%\.erlang.cookie" +@if "%cookie%" == "" @( + if exist "%default_cookie_file%" ( + set /p cookie=<%default_cookie_file% + ) else ( + echo No cookie is set or found. This limits the scripts functionality, installing, upgrading, rpc and getting a list of versions will not work. + ) ) :: Write the erl.ini file to set up paths relative to this script @@ -86,7 +96,7 @@ :: Collect any additional VM args into erl_opts @setlocal EnableDelayedExpansion -@for /f "usebackq tokens=1-2" %%I in (`findstr /r "^[^#]" "%vm_args%"`) do @( +@for /f "usebackq tokens=1-2" %%I in ('findstr /r "^[^#]" "%vm_args%"') do @( if not "%%I" == "-name" ( if not "%%I" == "-sname" ( if not "%%I" == "-setcookie" ( @@ -143,11 +153,10 @@ :: Set the ERTS dir from erl :set_erts_dir_from_erl @for /f "delims=" %%i in ('where erl') do @( - set erl=%%i + set "erl=%%i" ) -@set dir_cmd="%erl%" -sname dummy -boot no_dot_erlang -noshell -eval "io:format(\"~s\", [filename:nativename(code:root_dir())])." -s init stop -@for /f "delims=" %%i in ('%%dir_cmd%%') do @( - set erl_root=%%i +@for /f "delims=" %%i in ('"%erl%" -boot no_dot_erlang -noshell -eval "io:format(\"~s\", [filename:nativename(code:root_dir())])." -s init stop') do @( + set "erl_root=%%i" ) @set "erts_dir=%erl_root%\erts-%erts_vsn%" @set "rootdir=%erl_root%" @@ -164,12 +173,13 @@ set sys_config=-config "%possible_sys%" ) ) +@goto :eof :: Find the vm.args file :find_vm_args -@if not exist "%m_args%" ( - @if exist "%m_args%.orig" ( - ren "%m_args%.orig" vm.args +@if not exist "%vm_args%" ( + @if exist "%vm_args%.orig" ( + ren "%vm_args%.orig" vm.args ) ) @goto :eof @@ -351,3 +361,4 @@ set description=Erlang node %node_name%%hostname% in %rootdir% @if not "%ext_test_3%"=="x%extensions%" exit /b 0 @exit /b 1 + |