diff options
-rw-r--r-- | src/rlx_config.erl | 4 | ||||
-rw-r--r-- | src/rlx_prv_archive.erl | 13 | ||||
-rw-r--r-- | src/rlx_prv_assembler.erl | 4 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/rlx_config.erl b/src/rlx_config.erl index d82757b..3c3ba98 100644 --- a/src/rlx_config.erl +++ b/src/rlx_config.erl @@ -250,8 +250,12 @@ load_terms({release, {RelName, Vsn}, Applications, Config}, {ok, State0}) -> Release2 = rlx_release:config(Release1, Config), {ok, rlx_state:add_configured_release(State0, Release2)} end; +load_terms({vm_args, false}, {ok, State}) -> + {ok, rlx_state:vm_args(State, false)}; load_terms({vm_args, VmArgs}, {ok, State}) -> {ok, rlx_state:vm_args(State, filename:absname(VmArgs))}; +load_terms({sys_config, false}, {ok, State}) -> + {ok, rlx_state:sys_config(State, false)}; load_terms({sys_config, SysConfig}, {ok, State}) -> {ok, rlx_state:sys_config(State, filename:absname(SysConfig))}; load_terms({root_dir, Root}, {ok, State}) -> diff --git a/src/rlx_prv_archive.erl b/src/rlx_prv_archive.erl index e2d943f..e1735d1 100644 --- a/src/rlx_prv_archive.erl +++ b/src/rlx_prv_archive.erl @@ -109,6 +109,7 @@ update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion) -> erl_tar:extract(TarFile, [{cwd, TempDir}, compressed]), OverlayVars = rlx_prv_overlay:generate_overlay_vars(State, Release), OverlayFiles = overlay_files(OverlayVars, rlx_state:get(State, overlay, undefined), OutputDir), + ConfigFiles = config_files(Vsn, OutputDir), ok = erl_tar:create(TarFile, [{"releases", filename:join(TempDir, "releases")}, @@ -116,8 +117,6 @@ update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion) -> filename:join([OutputDir, "releases", "start_erl.data"])}, {filename:join(["releases", "RELEASES"]), filename:join([OutputDir, "releases", "RELEASES"])}, - {filename:join(["releases", Vsn, "vm.args"]), - filename:join([OutputDir, "releases", Vsn, "vm.args"])}, {"bin", filename:join([OutputDir, "bin"])} | case IncludeErts of false -> @@ -134,12 +133,19 @@ update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion) -> _ -> [{"lib", filename:join(TempDir, "lib")}, {"erts-"++ErtsVersion, filename:join(OutputDir, "erts-"++ErtsVersion)}] - end]++OverlayFiles, [dereference,compressed]), + end]++ConfigFiles++OverlayFiles, [dereference,compressed]), ec_cmd_log:info(rlx_state:log(State), "tarball ~s successfully created!~n", [TarFile]), ec_file:remove(TempDir, [recursive]), {ok, State}. +config_files(Vsn, OutputDir) -> + VMArgs = {filename:join(["releases", Vsn, "vm.args"]), filename:join([OutputDir, "releases", Vsn, "vm.args"])}, + VMArgsOrig = {filename:join(["releases", Vsn, "vm.args.orig"]), filename:join([OutputDir, "releases", Vsn, "vm.args.orig"])}, + SysConfigOrig = {filename:join(["releases", Vsn, "sys.config.orig"]), filename:join([OutputDir, "releases", Vsn, "sys.config.orig"])}, + [{NameInArchive, Filename} || {NameInArchive, Filename} <- [VMArgs, VMArgsOrig, SysConfigOrig], filelib:is_file(Filename)]. + + overlay_files(_, undefined, _) -> []; overlay_files(OverlayVars, Overlay, OutputDir) -> @@ -176,4 +182,3 @@ maybe_src_dirs(State) -> false -> []; true -> [src] end. - diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl index 8e0050c..2f08005 100644 --- a/src/rlx_prv_assembler.erl +++ b/src/rlx_prv_assembler.erl @@ -410,6 +410,8 @@ generate_start_erl_data_file(Release, ReleasesDir) -> copy_or_generate_vmargs_file(State, Release, RelDir) -> RelVmargsPath = filename:join([RelDir, "vm.args"]), case rlx_state:vm_args(State) of + false -> + ok; undefined -> RelName = erlang:atom_to_list(rlx_release:name(Release)), unless_exists_write_default(RelVmargsPath, vm_args_file(RelName)); @@ -428,6 +430,8 @@ copy_or_generate_vmargs_file(State, Release, RelDir) -> copy_or_generate_sys_config_file(State, RelDir) -> RelSysConfPath = filename:join([RelDir, "sys.config"]), case rlx_state:sys_config(State) of + false -> + ok; undefined -> unless_exists_write_default(RelSysConfPath, sys_config_file()); ConfigPath -> |