aboutsummaryrefslogtreecommitdiffstats
path: root/priv
diff options
context:
space:
mode:
Diffstat (limited to 'priv')
-rw-r--r--priv/templates/bin_windows2
-rwxr-xr-xpriv/templates/extended_bin17
-rw-r--r--priv/templates/extended_bin_windows8
-rw-r--r--priv/templates/install_upgrade_escript13
4 files changed, 28 insertions, 12 deletions
diff --git a/priv/templates/bin_windows b/priv/templates/bin_windows
index fbe4a71..06303f5 100644
--- a/priv/templates/bin_windows
+++ b/priv/templates/bin_windows
@@ -61,7 +61,7 @@ cd %rootdir%
set erl=%%i
)
@set dir_cmd="%erl%" -noshell -eval "io:format(\"~s\", [filename:nativename(code:root_dir())])." -s init stop
-@for /f %%i in ('%%dir_cmd%%') do (
+@for /f "delims=" %%i in ('%%dir_cmd%%') do (
set erl_root=%%i
)
@set erts_dir=%erl_root%\erts-%erts_vsn%
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin
index 8c523d9..7a9f0c7 100755
--- a/priv/templates/extended_bin
+++ b/priv/templates/extended_bin
@@ -163,14 +163,19 @@ PIPE_DIR="${PIPE_DIR:-/tmp/erl_pipes/$NAME/}"
# Extract the target cookie
COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)"
+DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie"
if [ -z "$COOKIE_ARG" ]; then
- echo "vm.args needs to have a -setcookie parameter."
- exit 1
+ if [ -f "$DEFAULT_COOKIE_FILE" ]; then
+ COOKIE="$(cat $DEFAULT_COOKIE_FILE)"
+ else
+ echo "vm.args needs to have a -setcookie, or $DEFAULT_COOKIE_FILE (its permission must be 400) is required."
+ exit 1
+ fi
+else
+ # Extract cookie name from COOKIE_ARG
+ COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
fi
-# Extract cookie name from COOKIE_ARG
-COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
-
find_erts_dir
export ROOTDIR="$RELEASE_ROOT_DIR"
export BINDIR="$ERTS_DIR/bin"
@@ -452,7 +457,7 @@ case "$1" in
relx_nodetool "eval" $@
;;
*)
- echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|escript|rpc|rpcterms|eval}"
+ echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|escript|rpc|rpcterms|eval}"
exit 1
;;
esac
diff --git a/priv/templates/extended_bin_windows b/priv/templates/extended_bin_windows
index 51c1bb2..d892ea6 100644
--- a/priv/templates/extended_bin_windows
+++ b/priv/templates/extended_bin_windows
@@ -99,7 +99,7 @@
set erl=%%i
)
@set dir_cmd="%erl%" -noshell -eval "io:format(\"~s\", [filename:nativename(code:root_dir())])." -s init stop
-@for /f %%i in ('%%dir_cmd%%') do @(
+@for /f "delims=" %%i in ('%%dir_cmd%%') do @(
set erl_root=%%i
)
@set erts_dir=%erl_root%\erts-%erts_vsn%
@@ -142,11 +142,11 @@
:: Install the release as a Windows service
:: or install the specified version passed as argument
:install
+set args=%erl_opts% -setcookie %cookie% ++ -rootdir \"%rootdir%\"
+set start_erl=%erts_dir%\bin\start_erl.exe
+set description=Erlang node %node_name% in %rootdir%
@if "" == "%2" (
:: Install the service
- set args=%erl_opts% -setcookie %cookie% ++ -rootdir \"%rootdir%\"
- set start_erl=%erts_dir%\bin\start_erl.exe
- set description=Erlang node %node_name% in %rootdir%
%erlsrv% add %service_name% %node_type% "%node_name%" -c "%description%" ^
-w "%rootdir%" -m "%start_erl%" -args "%args%" ^
-stopaction "init:stop()."
diff --git a/priv/templates/install_upgrade_escript b/priv/templates/install_upgrade_escript
index 4abce85..0910c38 100644
--- a/priv/templates/install_upgrade_escript
+++ b/priv/templates/install_upgrade_escript
@@ -92,7 +92,18 @@ install_and_permafy(TargetNode, RelName, Vsn) ->
[io_lib:format("* ~s\t~s~n",[V,S]) || {V,S} <- which_releases(TargetNode)]),
?INFO("Installed versions:~n~s", [VerList]),
?INFO("ERROR: Unable to revert to '~s' - not installed.~n", [Vsn]),
- erlang:halt(2)
+ erlang:halt(2);
+ %% as described in http://erlang.org/doc/man/appup.html, when performing a relup
+ %% with soft purge:
+ %% If the value is soft_purge, release_handler:install_release/1
+ %% returns {error,{old_processes,Mod}}
+ {error, {old_processes, Mod}} ->
+ ?INFO("ERROR: unable to install '~s' - old processes still running code from module ~p~n",
+ [Vsn, Mod]),
+ erlang:halt(3);
+ {error, Reason1} ->
+ ?INFO("ERROR: release_handler:install_release failed: ~p~n",[Reason1]),
+ erlang:halt(4)
end.
permafy(TargetNode, RelName, Vsn) ->