aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Merritt <[email protected]>2013-03-13 11:46:03 -0700
committerEric Merritt <[email protected]>2013-03-13 11:46:03 -0700
commitc7fd47264688ff74adafc18269a378c14742b284 (patch)
tree6c491fddb665ae86cb6113749549b7ca635ffc73 /src
parent6734e9ec4e0dd4c0678d10e8b8e48552ffb4e995 (diff)
parentb69815402b3456699a47273a8c731850fb6b7871 (diff)
downloadrelx-c7fd47264688ff74adafc18269a378c14742b284.tar.gz
relx-c7fd47264688ff74adafc18269a378c14742b284.tar.bz2
relx-c7fd47264688ff74adafc18269a378c14742b284.zip
Merge pull request #30 from tsloughter/next
Update readme, fix test, generate erl script with proper paths, copy start_clean.boot if config opt set
Diffstat (limited to 'src')
-rw-r--r--src/rcl_prv_assembler.erl32
-rw-r--r--src/rcl_prv_config.erl4
-rw-r--r--src/relcool.erl6
3 files changed, 29 insertions, 13 deletions
diff --git a/src/rcl_prv_assembler.erl b/src/rcl_prv_assembler.erl
index 63bd167..23a13bf 100644
--- a/src/rcl_prv_assembler.erl
+++ b/src/rcl_prv_assembler.erl
@@ -285,6 +285,14 @@ include_erts(State, Release, OutputDir, RelDir) ->
true ->
ok = ec_file:mkdir_p(LocalErts),
ok = ec_file:copy(ErtsDir, LocalErts, [recursive]),
+ ok = file:write_file(filename:join([LocalErts, "bin", "erl"]), erl_script(ErtsVersion)),
+ case rcl_state:get(State, extended_start_script, false) of
+ true ->
+ ok = ec_file:copy(filename:join([Prefix, "bin", "start_clean.boot"]),
+ filename:join([OutputDir, "bin", "start_clean.boot"]));
+ false ->
+ ok
+ end,
make_boot_script(State, Release, OutputDir, RelDir)
end;
_ ->
@@ -345,6 +353,22 @@ get_code_paths(Release, OutDir) ->
rcl_app_info:vsn_as_string(App), "ebin"]) ||
App <- rcl_release:application_details(Release)].
+erl_script(ErtsVsn) ->
+ [<<"#!/bin/sh
+set -e
+
+SCRIPT_DIR=`dirname $0`
+ROOTDIR=`cd $SCRIPT_DIR/../../ && pwd`
+BINDIR=$ROOTDIR/erts-">>, ErtsVsn, <<"/bin
+EMU=beam
+PROGNAME=`echo $0 | sed 's/.*\\///'`
+export EMU
+export ROOTDIR
+export BINDIR
+export PROGNAME
+exec \"$BINDIR/erlexec\" ${1+\"$@\"}
+">>].
+
bin_file_contents(RelName, RelVsn, ErtsVsn, ErlOpts) ->
[<<"#!/bin/sh
@@ -358,14 +382,6 @@ ERTS_VSN=">>, ErtsVsn, <<"
REL_DIR=$RELEASE_ROOT_DIR/releases/$REL_NAME-$REL_VSN
ERL_OPTS=">>, ErlOpts, <<"
-ERTS_DIR=
-SYS_CONFIG=
-ROOTDIR=
-
-ERTS_DIR=
-SYS_CONFIG=
-ROOTDIR=
-
find_erts_dir() {
local erts_dir=$RELEASE_ROOT_DIR/erts-$ERTS_VSN
if [ -d \"$erts_dir\" ]; then
diff --git a/src/rcl_prv_config.erl b/src/rcl_prv_config.erl
index 60655b1..1027edf 100644
--- a/src/rcl_prv_config.erl
+++ b/src/rcl_prv_config.erl
@@ -54,8 +54,8 @@ do(State) ->
-spec format_error(Reason::term()) -> iolist().
format_error({consult, ConfigFile, Reason}) ->
- io_lib:format("Unable to read file ~s: ~s", [ConfigFile,
- file:format_error(Reason)]);
+ io_lib:format("Unable to read file ~s: ~s", [ConfigFile,
+ file:format_error(Reason)]);
format_error({invalid_term, Term}) ->
io_lib:format("Invalid term in config file: ~p", [Term]).
diff --git a/src/relcool.erl b/src/relcool.erl
index c8c0cde..7750efa 100644
--- a/src/relcool.erl
+++ b/src/relcool.erl
@@ -70,7 +70,7 @@ main(Args) ->
%% @param OutputDir - The directory where the release should be built to
%% @param Configs - The list of config files for the system
-spec do(atom(), string(), [goal()], [file:name()], rcl_log:log_level(),
- [file:name()], file:name()) ->
+ [file:name()], file:name() | undefined) ->
ok | error() | {ok, rcl_state:t()}.
do(RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Config) ->
{ok, Cwd} = file:get_cwd(),
@@ -87,7 +87,7 @@ do(RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Config) ->
%% @param OutputDir - The directory where the release should be built to
%% @param Configs - The list of config files for the system
-spec do(file:name(), atom(), string(), [goal()], [file:name()],
- rcl_log:log_level(), [file:name()], file:name()) ->
+ rcl_log:log_level(), [file:name()], file:name() | undefined) ->
ok | error() | {ok, rcl_state:t()}.
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Configs) ->
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, [], Configs).
@@ -104,7 +104,7 @@ do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Configs) ->
%% @param Overrides - A list of overrides for the system
%% @param Configs - The list of config files for the system
-spec do(file:name(), atom(), string(), [goal()], [file:name()],
- rcl_log:log_level(), [file:name()], [{atom(), file:name()}], file:name()) ->
+ rcl_log:log_level(), [file:name()], [{atom(), file:name()}], file:name() | undefined) ->
ok | error() | {ok, rcl_state:t()}.
do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Config) ->
State = rcl_state:new([{relname, RelName},