mirror of
https://github.com/correl/rebar.git
synced 2024-11-27 11:09:55 +00:00
Quote paths in Windows runner script
This allows the node to run in paths which include special characters, for example 'C:\Program Files (x86)\Product Name'
This commit is contained in:
parent
556f47579d
commit
471b5714eb
2 changed files with 36 additions and 23 deletions
|
@ -9,19 +9,28 @@
|
||||||
@set releases_dir=%node_root%\releases
|
@set releases_dir=%node_root%\releases
|
||||||
|
|
||||||
@rem Parse ERTS version and release version from start_erl.data
|
@rem Parse ERTS version and release version from start_erl.data
|
||||||
@for /F "tokens=1,2" %%I in (%releases_dir%\start_erl.data) do @(
|
@for /F "usebackq tokens=1,2" %%I in ("%releases_dir%\start_erl.data") do @(
|
||||||
@call :set_trim erts_version %%I
|
@call :set_trim erts_version %%I
|
||||||
@call :set_trim release_version %%J
|
@call :set_trim release_version %%J
|
||||||
)
|
)
|
||||||
|
|
||||||
@rem extract erlang cookie from vm.args
|
|
||||||
@set vm_args=%releases_dir%\%release_version%\vm.args
|
@set vm_args=%releases_dir%\%release_version%\vm.args
|
||||||
@for /f "usebackq tokens=1-2" %%I in (`findstr /b \-setcookie %vm_args%`) do @set erlang_cookie=%%J
|
@set sys_config=%releases_dir%\%release_version%\sys.config
|
||||||
|
@set node_boot_script=%releases_dir%\%release_version%\%node_name%
|
||||||
|
@set clean_boot_script=%releases_dir%\%release_version%\start_clean
|
||||||
|
|
||||||
|
@rem extract erlang cookie from vm.args
|
||||||
|
@for /f "usebackq tokens=1-2" %%I in (`findstr /b \-setcookie "%vm_args%"`) do @set erlang_cookie=%%J
|
||||||
|
|
||||||
@set erts_bin=%node_root%\erts-%erts_version%\bin
|
@set erts_bin=%node_root%\erts-%erts_version%\bin
|
||||||
|
|
||||||
@set service_name=%node_name%_%release_version%
|
@set service_name=%node_name%_%release_version%
|
||||||
|
|
||||||
|
@set erlsrv="%erts_bin%\erlsrv.exe"
|
||||||
|
@set epmd="%erts_bin%\epmd.exe"
|
||||||
|
@set escript="%erts_bin%\escript.exe"
|
||||||
|
@set werl="%erts_bin%\werl.exe"
|
||||||
|
|
||||||
@if "%1"=="usage" @goto usage
|
@if "%1"=="usage" @goto usage
|
||||||
@if "%1"=="install" @goto install
|
@if "%1"=="install" @goto install
|
||||||
@if "%1"=="uninstall" @goto uninstall
|
@if "%1"=="uninstall" @goto uninstall
|
||||||
|
@ -39,34 +48,37 @@
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:install
|
:install
|
||||||
@%erts_bin%\erlsrv.exe add %service_name% -c "Erlang node %node_name% in %node_root%" -sname %node_name% -w %node_root% -m %node_root%\bin\start_erl.cmd -args " ++ %node_name% ++ %node_root%" -stopaction "init:stop()."
|
@set description=Erlang node %node_name% in %node_root%
|
||||||
|
@set start_erl=%node_root%\bin\start_erl.cmd
|
||||||
|
@set args= ++ %node_name% ++ %node_root%
|
||||||
|
@%erlsrv% add %service_name% -c "%description%" -sname %node_name% -w "%node_root%" -m "%start_erl%" -args "%args%" -stopaction "init:stop()."
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:uninstall
|
:uninstall
|
||||||
@%erts_bin%\erlsrv.exe remove %service_name%
|
@%erlsrv% remove %service_name%
|
||||||
@%erts_bin%\epmd.exe -kill
|
@%epmd% -kill
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:start
|
:start
|
||||||
@%erts_bin%\erlsrv.exe start %service_name%
|
@%erlsrv% start %service_name%
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:stop
|
:stop
|
||||||
@%erts_bin%\erlsrv.exe stop %service_name%
|
@%erlsrv% stop %service_name%
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:console
|
:console
|
||||||
@start %erts_bin%\werl.exe -boot %releases_dir%\%release_version%\%node_name% -config %releases_dir%\%release_version%\sys.config -args_file %vm_args% -sname %node_name%
|
@start "%node_name% console" %werl% -boot "%node_boot_script%" -config "%sys_config%" -args_file "%vm_args%" -sname %node_name%
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:query
|
:query
|
||||||
@%erts_bin%\erlsrv.exe list %service_name%
|
@%erlsrv% list %service_name%
|
||||||
@exit /b %ERRORLEVEL%
|
@exit %ERRORLEVEL%
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:attach
|
:attach
|
||||||
@for /f "usebackq" %%I in (`hostname`) do @set hostname=%%I
|
@for /f "usebackq" %%I in (`hostname`) do @set hostname=%%I
|
||||||
start %erts_bin%\werl.exe -boot %releases_dir%\%release_version%\start_clean -remsh %node_name%@%hostname% -sname console -setcookie %erlang_cookie%
|
start "%node_name% attach" %werl% -boot "%clean_boot_script%" -remsh %node_name%@%hostname% -sname console -setcookie %erlang_cookie%
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:upgrade
|
:upgrade
|
||||||
|
@ -76,7 +88,7 @@ start %erts_bin%\werl.exe -boot %releases_dir%\%release_version%\start_clean -re
|
||||||
@echo NOTE {package base name} MUST NOT include the .tar.gz suffix
|
@echo NOTE {package base name} MUST NOT include the .tar.gz suffix
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
)
|
)
|
||||||
@%erts_bin%\escript.exe %node_root%\bin\install_upgrade.escript %node_name% %erlang_cookie% %2
|
@%escript% %node_root%\bin\install_upgrade.escript %node_name% %erlang_cookie% %2
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:set_trim
|
:set_trim
|
||||||
|
|
|
@ -6,30 +6,31 @@
|
||||||
@for /F "delims=++ tokens=1,2,3" %%I in (%args%) do @(
|
@for /F "delims=++ tokens=1,2,3" %%I in (%args%) do @(
|
||||||
@set erl_args=%%I
|
@set erl_args=%%I
|
||||||
@call :set_trim node_name %%J
|
@call :set_trim node_name %%J
|
||||||
@call :set_trim node_root %%K
|
@rem Trim spaces from the left of %%K (node_root), which may have spaces inside
|
||||||
|
@for /f "tokens=* delims= " %%a in ("%%K") do @set node_root=%%a
|
||||||
)
|
)
|
||||||
|
|
||||||
@set releases_dir=%node_root%\releases
|
@set releases_dir=%node_root%\releases
|
||||||
|
|
||||||
@rem parse ERTS version and release version from start_erl.dat
|
@rem parse ERTS version and release version from start_erl.dat
|
||||||
@for /F "tokens=1,2" %%I in (%releases_dir%\start_erl.data) do @(
|
@for /F "usebackq tokens=1,2" %%I in ("%releases_dir%\start_erl.data") do @(
|
||||||
@call :set_trim erts_version %%I
|
@call :set_trim erts_version %%I
|
||||||
@call :set_trim release_version %%J
|
@call :set_trim release_version %%J
|
||||||
)
|
)
|
||||||
|
|
||||||
@set erl_exe=%node_root%\erts-%erts_version%\bin\erl.exe
|
@set erl_exe="%node_root%\erts-%erts_version%\bin\erl.exe"
|
||||||
@set boot_file=%releases_dir%\%release_version%\%node_name%
|
@set boot_file="%releases_dir%\%release_version%\%node_name%"
|
||||||
|
|
||||||
@if exist %releases_dir%\%release_version%\sys.config (
|
@if exist "%releases_dir%\%release_version%\sys.config" (
|
||||||
@set app_config=%releases_dir%\%release_version%\sys.config
|
@set app_config="%releases_dir%\%release_version%\sys.config"
|
||||||
) else (
|
) else (
|
||||||
@set app_config=%node_root%\etc\app.config
|
@set app_config="%node_root%\etc\app.config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@if exist %releases_dir%\%release_version%\vm.args (
|
@if exist "%releases_dir%\%release_version%\vm.args" (
|
||||||
@set vm_args=%releases_dir%\%release_version%\vm.args
|
@set vm_args="%releases_dir%\%release_version%\vm.args"
|
||||||
) else (
|
) else (
|
||||||
@set vm_args=%node_root%\etc\vm.args
|
@set vm_args="%node_root%\etc\vm.args"
|
||||||
)
|
)
|
||||||
|
|
||||||
@%erl_exe% %erl_args% -boot %boot_file% -config %app_config% -args_file %vm_args%
|
@%erl_exe% %erl_args% -boot %boot_file% -config %app_config% -args_file %vm_args%
|
||||||
|
|
Loading…
Reference in a new issue