aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates/bin_windows
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2015-04-28 22:36:44 -0500
committerTristan Sloughter <[email protected]>2015-05-08 11:16:53 -0500
commit88d1f29257869b0de9369881236477163804125a (patch)
treec14b95ae8efdebcf074d314b6b0afb662f3454fb /priv/templates/bin_windows
parenta36609536aaf7d98b5bd5d3364cab739dc6689b5 (diff)
downloadrelx-88d1f29257869b0de9369881236477163804125a.tar.gz
relx-88d1f29257869b0de9369881236477163804125a.tar.bz2
relx-88d1f29257869b0de9369881236477163804125a.zip
use mustache instead of erlydtl for overlays
Diffstat (limited to 'priv/templates/bin_windows')
-rw-r--r--priv/templates/bin_windows85
1 files changed, 85 insertions, 0 deletions
diff --git a/priv/templates/bin_windows b/priv/templates/bin_windows
new file mode 100644
index 0000000..3466292
--- /dev/null
+++ b/priv/templates/bin_windows
@@ -0,0 +1,85 @@
+:: This is a simple start batch file that runs the release in an Erlang shell
+
+:: Set variables that describe the release
+@set rel_name={{ rel_name }}
+@set rel_vsn={{ rel_vsn }}
+@set erts_vsn={{ erts_vsn }}
+@set erl_opts={{ erl_opts }}
+
+:: Set the root release directory based on the location of this batch file
+@set script_dir=%~dp0
+@for %%A in ("%script_dir%\..") do (
+ set "release_root_dir=%%~fA"
+)
+@set rel_dir=%release_root_dir%\releases\%rel_vsn%
+
+@call :find_erts_dir
+@call :find_sys_config
+@call :set_boot_script_var
+
+@set rootdir=%release_root_dir%
+@set bindir=%erts_dir%\bin
+@set progname=erl
+@set erl=%bindir%\erl
+
+cd %rootdir%
+
+:: Write the erl.ini file
+@set erl_ini=%erts_dir%\bin\erl.ini
+@set converted_bindir=%bindir:\=\\%
+@set converted_rootdir=%rootdir:\=\\%
+@echo [erlang] > "%erl_ini%"
+@echo Bindir=%converted_bindir% >> "%erl_ini%"
+@echo Progname=%progname% >> "%erl_ini%"
+@echo Rootdir=%converted_rootdir% >> "%erl_ini%"
+
+:: Start the release in an `erl` shell
+@"%erl%" %erl_opts% %sys_config% -boot "%boot_script%" %*
+
+@goto :eof
+
+:: Find the ERTS dir
+:find_erts_dir
+@set erts_dir=%release_root_dir%\erts-%erts_vsn%
+@if exist %erts_dir% (
+ goto :set_erts_dir_from_default
+) else (
+ goto :set_erts_dir_from_erl
+)
+@goto :eof
+
+:: Set the ERTS dir from the passed in erts_vsn
+:set_erts_dir_from_default
+@set erts_dir=%erts_dir%
+@set root_dir=%release_root_dir%
+@goto :eof
+
+:: Set the ERTS dir from erl
+:set_erts_dir_from_erl
+@for /f "delims=" %%i in ('where erl') do (
+ set erl=%%i
+)
+@set dir_cmd="%erl%" -noshell -eval "io:format(\"~s\", [filename:nativename(code:root_dir())])." -s init stop
+@for /f %%i in ('%%dir_cmd%%') do (
+ set erl_root=%%i
+)
+@set erts_dir=%erl_root%\erts-%erts_vsn%
+@set rootdir=%erl_root%
+@goto :eof
+
+:: Find the sys.config file
+:find_sys_config
+@set possible_sys=%rel_dir%\sys.config
+@if exist "%possible_sys%" (
+ set sys_config=-config "%possible_sys%"
+)
+@goto :eof
+
+:: set boot_script variable
+:set_boot_script_var
+@if exist "%rel_dir%\%rel_name%.boot" (
+ set boot_script=%rel_dir%\%rel_name%
+) else (
+ set boot_script=%rel_dir%\start
+)
+@goto :eof