aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_prv_assembler.erl
diff options
context:
space:
mode:
authorOlav Frengstad <[email protected]>2013-06-20 09:53:23 +0200
committerOlav Frengstad <[email protected]>2013-06-20 10:04:53 +0200
commit5ed7ea3172170fa05ac806250f695834d5d6ae58 (patch)
tree0247674887803bb006fb2384c0bc4e98e4371e04 /src/rlx_prv_assembler.erl
parentc5f0a8c9175b2d152c69f72da15e7ceff411f86b (diff)
downloadrelx-5ed7ea3172170fa05ac806250f695834d5d6ae58.tar.gz
relx-5ed7ea3172170fa05ac806250f695834d5d6ae58.tar.bz2
relx-5ed7ea3172170fa05ac806250f695834d5d6ae58.zip
Add support for {vm_args,_} argument in config
Diffstat (limited to 'src/rlx_prv_assembler.erl')
-rw-r--r--src/rlx_prv_assembler.erl21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index 18a372c..20f9c5c 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -250,9 +250,28 @@ write_bin_file(State, Release, OutputDir, RelDir) ->
ok = file:write_file(BareRel, StartFile),
ok = file:change_mode(BareRel, 8#777)
end,
- ok = file:write_file(filename:join(RelDir, "vm.args"), vm_args_file(RelName)),
+ copy_or_generate_vmargs_file(State, RelName, RelDir),
copy_or_generate_sys_config_file(State, Release, OutputDir, RelDir).
+%% @doc copy vm.args or generate one to releases/VSN/vm.args
+-spec copy_or_generate_vmargs_file(rlx_state:t(), string(), file:name()) ->
+ {ok, rlx_state:t()} | relx:error().
+
+copy_or_generate_vmargs_file(State, RelName, RelDir) ->
+ RelVmargsPath = filename:join([RelDir, "vm.args"]),
+
+ case rlx_state:vm_args(State) of
+ undefined ->
+ ok = file:write_file(RelVmargsPath, vm_args_file(RelName));
+ ArgsPath ->
+ case filelib:is_regular(ArgsPath) of
+ false ->
+ ?RLX_ERROR({vmargs_does_not_exist, ArgsPath});
+ true ->
+ ec_file:copy(ArgsPath, RelVmargsPath)
+ end
+ end.
+
%% @doc copy config/sys.config or generate one to releases/VSN/sys.config
-spec copy_or_generate_sys_config_file(rlx_state:t(), rlx_release:t(),
file:name(), file:name()) ->