aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2016-08-24 12:44:03 -0700
committerGitHub <[email protected]>2016-08-24 12:44:03 -0700
commit766a2fb0c1724193a5846c3baee5d7f17f343ac5 (patch)
tree01840c574888ee84a7aaaa2e6cda7c5422e8dd81
parentf2877a2dc9513c7f98c8a962798379c5c89f4246 (diff)
parent77b8e9202715d526b1bae06b4a8a7882e501dfdc (diff)
downloadrelx-3.21.0.tar.gz
relx-3.21.0.tar.bz2
relx-3.21.0.zip
Merge pull request #479 from emtenet/add-boot-varv3.21.0
Fix for #478 Boot variable $ERTS_LIB_DIR not supplied in Windows scripts
-rw-r--r--priv/templates/bin_windows3
-rw-r--r--priv/templates/extended_bin_windows6
-rw-r--r--src/rlx_prv_assembler.erl24
3 files changed, 29 insertions, 4 deletions
diff --git a/priv/templates/bin_windows b/priv/templates/bin_windows
index fa1c2cc..06303f5 100644
--- a/priv/templates/bin_windows
+++ b/priv/templates/bin_windows
@@ -34,7 +34,8 @@ cd %rootdir%
@echo Rootdir=%converted_rootdir% >> "%erl_ini%"
:: Start the release in an `erl` shell
-@"%erl%" %erl_opts% %sys_config% -boot "%boot_script%" %*
+@set boot=-boot "%boot_script%" -boot_var RELEASE_DIR "%release_root_dir%"
+@"%erl%" %erl_opts% %sys_config% %boot% %*
@goto :eof
diff --git a/priv/templates/extended_bin_windows b/priv/templates/extended_bin_windows
index e5ab40a..d892ea6 100644
--- a/priv/templates/extended_bin_windows
+++ b/priv/templates/extended_bin_windows
@@ -186,7 +186,8 @@ set description=Erlang node %node_name% in %rootdir%
:: Start a console
:console
-@start "%rel_name% console" %werl% -boot "%boot_script%" %sys_config% ^
+@set boot=-boot "%boot_script%" -boot_var RELEASE_DIR "%release_root_dir%"
+@start "%rel_name% console" %werl% %boot% %sys_config% ^
-args_file "%vm_args%"
@goto :eof
@@ -202,6 +203,7 @@ set description=Erlang node %node_name% in %rootdir%
:: Attach to a running node
:attach
-@start "%node_name% attach" %werl% -boot "%clean_boot_script%" ^
+@set boot=-boot "%clean_boot_script%" -boot_var RELEASE_DIR "%release_root_dir%"
+@start "%node_name% attach" %werl% %boot% ^
-remsh %node_name% %node_type% console -setcookie %cookie%
@goto :eof
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index 2f08005..53b7dfa 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -525,7 +525,7 @@ include_erts(State, Release, OutputDir, RelDir) ->
make_boot_script(State, Release, OutputDir, RelDir) ->
Options = [{path, [RelDir | rlx_util:get_code_paths(Release, OutputDir)]},
{outdir, RelDir},
- {variables, [{"ERTS_LIB_DIR", code:lib_dir()}]},
+ {variables, make_boot_script_variables(State)},
no_module_tests, silent],
Name = erlang:atom_to_list(rlx_release:name(Release)),
ReleaseFile = filename:join([RelDir, Name ++ ".rel"]),
@@ -551,6 +551,28 @@ make_boot_script(State, Release, OutputDir, RelDir) ->
?RLX_ERROR({release_script_generation_error, Module, Error})
end.
+make_boot_script_variables(State) ->
+ % A boot variable is needed when {include_erts, false} and the application
+ % directories are split between the release/lib directory and the erts/lib
+ % directory.
+ % The built-in $ROOT variable points to the erts directory on Windows
+ % (dictated by erl.ini [erlang] Rootdir=) and so a boot variable is made
+ % pointing to the release directory
+ % On non-Windows, $ROOT is set by the ROOTDIR environment variable as the
+ % release directory, so a boot variable is made pointing to the erts
+ % directory.
+ % NOTE the boot variable can point to either the release/erts root directory
+ % or the release/erts lib directory, as long as the usage here matches the
+ % usage used in the start up scripts
+ case {os:type(), rlx_state:get(State, include_erts, true)} of
+ {{win32, _}, false} ->
+ [{"RELEASE_DIR", rlx_state:output_dir(State)}];
+ {{win32, _}, true} ->
+ [];
+ _ ->
+ [{"ERTS_LIB_DIR", code:lib_dir()}]
+ end.
+
create_start_clean(RelDir, OutputDir, Options, State) ->
case rlx_util:make_script(Options,
fun(CorrectedOptions) ->