aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoremtenet <[email protected]>2016-04-16 13:09:58 +1000
committeremtenet <[email protected]>2016-04-29 22:01:08 +1000
commit77b8e9202715d526b1bae06b4a8a7882e501dfdc (patch)
treec3caa138a093a821001dd9532882792b8d0a471f /src
parent1e15397a4924804f248facc18ccd07076baef7a4 (diff)
downloadrelx-77b8e9202715d526b1bae06b4a8a7882e501dfdc.tar.gz
relx-77b8e9202715d526b1bae06b4a8a7882e501dfdc.tar.bz2
relx-77b8e9202715d526b1bae06b4a8a7882e501dfdc.zip
Add a boot variable to Windows scripts
Add missing -boot_var argument to Windows scripts when starting erlang. Use different boot variables on Windows vs non-Windows. The built-in $ROOT boot variable points to the erts directory on Windows (dictated by erl.ini [erlang] Rootdir=) and so a boot variable $RELEASE_DIR is made pointing to the release directory
Diffstat (limited to 'src')
-rw-r--r--src/rlx_prv_assembler.erl24
1 files changed, 23 insertions, 1 deletions
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) ->