aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README.md1
-rw-r--r--bootstrap.cmd8
-rw-r--r--priv/templates/bin_windows.dtl12
-rw-r--r--priv/templates/extended_bin.dtl21
-rw-r--r--priv/templates/extended_bin_windows.dtl16
-rw-r--r--src/relx.erl1
-rw-r--r--src/rlx_cmd_args.erl3
-rw-r--r--src/rlx_config.erl7
9 files changed, 48 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 13cbe44..a6e5c52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ ebin/*
.eunit
.relx_plt
relx
+relx.cmd
priv/templates/*.erl
# This is a generated file that should be ignored
src/rcl_goal.erl
diff --git a/README.md b/README.md
index 7c68dfb..9e7217c 100644
--- a/README.md
+++ b/README.md
@@ -80,6 +80,7 @@ Options
| -a | --override_app | string | | An app name and a directory to override in the form appname:dir |
| -c | --config | string | ./relx.config | Config file path |
| | --overlay_vars | string | | Path to a file of overlay variables |
+| | --vm_args | string | | Path to a file to use for vm.args |
| | --sys_config | string | | Path to a file to use for sys.config |
| -d | --dev-mode | boolean | false | Symlink all applications and configuration into the release instead of copying|
| -i | --include-erts | boolean/string | true | If true include a copy of erts used to build with, if a path include erts at that path. If false, do not include erts |
diff --git a/bootstrap.cmd b/bootstrap.cmd
index 86ffc7f..cff8483 100644
--- a/bootstrap.cmd
+++ b/bootstrap.cmd
@@ -6,7 +6,7 @@
:: Create a shortcut file for running the relx command
@set relx_cmd=relx.cmd
-@echo @echo off > %relx_cmd%
-@echo setlocal >> %relx_cmd%
-@echo set relx=%%~f0 >> %relx_cmd%
-@echo escript ^"%%relx:.cmd=%%^" %%* >> %relx_cmd%
+@echo @echo off> %relx_cmd%
+@echo setlocal>> %relx_cmd%
+@echo set relx=%%~f0>> %relx_cmd%
+@echo escript ^"%%relx:.cmd=%%^" %%*>> %relx_cmd%
diff --git a/priv/templates/bin_windows.dtl b/priv/templates/bin_windows.dtl
index 170d957..7a8952b 100644
--- a/priv/templates/bin_windows.dtl
+++ b/priv/templates/bin_windows.dtl
@@ -15,6 +15,7 @@
@call :find_erts_dir
@call :find_sys_config
+@call :set_boot_script_var
@set rootdir=%release_root_dir%
@set bindir=%erts_dir%\bin
@@ -33,7 +34,7 @@ cd %rootdir%
@echo Rootdir=%converted_rootdir% >> "%erl_ini%"
:: Start the release in an `erl` shell
-@%erl% %erl_opts% %sys_config% -boot "%rel_dir%\%rel_name%" %*
+@%erl% %erl_opts% %sys_config% -boot "%boot_script%" %*
@goto :eof
@@ -73,3 +74,12 @@ cd %rootdir%
@set sys_config=-config "%possible_sys%"
)
@goto :eof
+
+:: set boot_script variable
+:set_boot_script_var
+@if exist "%rel_dir%\%rel_name%.boot" (
+ @set boot_script=%rel_dir%\%rel_name%
+) else (
+ @set boot_script=%rel_dir%\start
+)
+@goto :eof
diff --git a/priv/templates/extended_bin.dtl b/priv/templates/extended_bin.dtl
index 745691f..ec4a8f3 100644
--- a/priv/templates/extended_bin.dtl
+++ b/priv/templates/extended_bin.dtl
@@ -9,7 +9,6 @@ REL_VSN="{{ rel_vsn }}"
ERTS_VSN="{{ erts_vsn }}"
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
ERL_OPTS="{{ erl_opts }}"
-PIPE_DIR="${PIPE_DIR:-/tmp/erl_pipes/{{ rel_name }}/}"
RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_ROOT_DIR/log}"
find_erts_dir() {
@@ -55,10 +54,10 @@ relx_nodetool() {
# Run an escript in the node's environment
relx_escript() {
- command="$1"; shift
+ shift; scriptpath="$1"; shift
export RELEASE_ROOT_DIR
- "$ERTS_DIR/bin/escript" "$ROOTDIR/$command" $@
+ "$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" $@
}
# Output a start command for the last argument of run_erl
relx_start_command() {
@@ -122,6 +121,8 @@ case $NAME in
;;
esac
+PIPE_DIR="${PIPE_DIR:-/tmp/erl_pipes/$NAME/}"
+
# Extract the target cookie
COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH")"
if [ -z "$COOKIE_ARG" ]; then
@@ -187,16 +188,16 @@ case "$1" in
Linux|Darwin|FreeBSD|DragonFly|NetBSD|OpenBSD)
# PID COMMAND
PID=$(ps ax -o pid= -o command=|
- grep "$SCRIPT_DIR/.*/[b]eam"|awk '{print $1}')
+ grep "$RELEASE_ROOT_DIR/.*/[b]eam"|awk '{print $1}')
;;
SunOS)
# PID COMMAND
PID=$(ps -ef -o pid= -o args=|
- grep "$SCRIPT_DIR/.*/[b]eam"|awk '{print $1}')
+ grep "$RELEASE_ROOT_DIR/.*/[b]eam"|awk '{print $1}')
;;
CYGWIN*)
# UID PID PPID TTY STIME COMMAND
- PID=$(ps -efw|grep "$SCRIPT_DIR/.*/[b]eam"|awk '{print $2}')
+ PID=$(ps -efw|grep "$RELEASE_ROOT_DIR/.*/[b]eam"|awk '{print $2}')
;;
esac
if ! relx_nodetool "stop"; then
@@ -317,7 +318,7 @@ case "$1" in
-args_file "$VMARGS_PATH"
# Dump environment info for logging purposes
- echo "Exec: $@ -- ${1+$ARGS}"
+ echo "Exec: $@" -- ${1+$ARGS}
echo "Root: $ROOTDIR"
# Log the startup
@@ -325,7 +326,7 @@ case "$1" in
logger -t "$REL_NAME[$$]" "Starting up"
# Start the VM
- exec "$@" -- "${1+$ARGS}"
+ exec "$@" -- ${1+$ARGS}
;;
foreground)
@@ -352,11 +353,11 @@ case "$1" in
-args_file "$VMARGS_PATH"
# Dump environment info for logging purposes
- echo "Exec: $@" -- "${1+$ARGS}"
+ echo "Exec: $@" -- ${1+$ARGS}
echo "Root: $ROOTDIR"
# Start the VM
- exec "$@" -- "${1+$ARGS}"
+ exec "$@" -- ${1+$ARGS}
;;
*)
echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|escript}"
diff --git a/priv/templates/extended_bin_windows.dtl b/priv/templates/extended_bin_windows.dtl
index 1f94675..26340a4 100644
--- a/priv/templates/extended_bin_windows.dtl
+++ b/priv/templates/extended_bin_windows.dtl
@@ -29,11 +29,11 @@
@call :find_erts_dir
@call :find_sys_config
+@call :set_boot_script_var
@set bindir=%erts_dir%\bin
@set vm_args=%rel_dir%\vm.args
@set progname=erl.exe
-@set boot_script=%rel_dir%\%rel_name%
@set clean_boot_script=%release_root_dir%\bin\start_clean
@set erlsrv="%bindir%\erlsrv.exe"
@set epmd="%bindir%\epmd.exe"
@@ -55,11 +55,6 @@
:: Write the erl.ini file to set up paths relative to this script
@call :write_ini
-:: If a start.boot file is not present, copy one from the named .boot file
-@if not exist "%rel_dir%\start.boot" (
- @copy "%rel_dir%\%rel_name%.boot" "%rel_dir%\start.boot" >nul
-)
-
@if "%1"=="install" @goto install
@if "%1"=="uninstall" @goto uninstall
@if "%1"=="start" @goto start
@@ -111,6 +106,15 @@
)
@goto :eof
+:: set boot_script variable
+:set_boot_script_var
+@if exist "%rel_dir%\%rel_name%.boot" (
+ @set boot_script=%rel_dir%\%rel_name%
+) else (
+ @set boot_script=%rel_dir%\start
+)
+@goto :eof
+
:: Write the erl.ini file
:write_ini
@set erl_ini=%erts_dir%\bin\erl.ini
diff --git a/src/relx.erl b/src/relx.erl
index cf0b367..25f3220 100644
--- a/src/relx.erl
+++ b/src/relx.erl
@@ -210,6 +210,7 @@ opt_spec_list() ->
"Provide an app name and a directory to override in the form <appname>:<app directory>"},
{config, $c, "config", {string, ""}, "The path to a config file"},
{overlay_vars, undefined, "overlay_vars", string, "Path to a file of overlay variables"},
+ {vm_args, undefined, "vm_args", string, "Path to a file to use for vm.args"},
{sys_config, undefined, "sys_config", string, "Path to a file to use for sys.config"},
{system_libs, undefined, "system_libs", string, "Path to dir of Erlang system libs"},
{version, undefined, "version", undefined, "Print relx version"},
diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl
index ac3e718..44fd226 100644
--- a/src/rlx_cmd_args.erl
+++ b/src/rlx_cmd_args.erl
@@ -240,6 +240,9 @@ create(overlay_vars, Opts)->
create(sys_config, Opts) ->
SysConfig = proplists:get_value(sys_config, Opts, undefined),
{sys_config, SysConfig};
+create(vm_args, Opts) ->
+ VmArgs = proplists:get_value(vm_args, Opts, undefined),
+ {vm_args, VmArgs};
create(system_libs, Opts) ->
SystemLibs = proplists:get_value(system_libs, Opts, undefined),
{system_libs, SystemLibs};
diff --git a/src/rlx_config.erl b/src/rlx_config.erl
index dbfe1c6..07ac2c5 100644
--- a/src/rlx_config.erl
+++ b/src/rlx_config.erl
@@ -205,7 +205,12 @@ load_terms({release, {RelName, Vsn}, {erts, ErtsVsn},
{ok, rlx_state:add_configured_release(State, Release1)}
end;
load_terms({vm_args, VmArgs}, {ok, State}) ->
- {ok, rlx_state:vm_args(State, filename:absname(VmArgs))};
+ case rlx_state:vm_args(State) of
+ undefined ->
+ {ok, rlx_state:vm_args(State, filename:absname(VmArgs))};
+ _ ->
+ {ok, State}
+ end;
load_terms({sys_config, SysConfig}, {ok, State}) ->
case rlx_state:sys_config(State) of
undefined ->