diff options
-rw-r--r-- | priv/templates/bin_windows | 2 | ||||
-rwxr-xr-x | priv/templates/extended_bin | 17 | ||||
-rw-r--r-- | priv/templates/extended_bin_windows | 8 | ||||
-rw-r--r-- | priv/templates/install_upgrade_escript | 13 | ||||
-rw-r--r-- | rebar.config | 3 | ||||
-rw-r--r-- | rebar.lock | 2 |
6 files changed, 31 insertions, 14 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) -> diff --git a/rebar.config b/rebar.config index 467cd4e..618d8d7 100644 --- a/rebar.config +++ b/rebar.config @@ -1,6 +1,6 @@ %% -*- mode: Erlang; fill-column: 80; comment-column: 75; -*- %% Dependencies ================================================================ -{deps, [{erlware_commons, "0.19.0"}, +{deps, [{erlware_commons, "0.21.0"}, {providers, "1.6.0"}, {getopt, "0.8.2"}, {cf, "0.2.1"}, @@ -33,6 +33,7 @@ {overrides, [{override, erlware_commons, [ {erl_opts, [{platform_define, "^[0-9]+", namespaced_types}, {platform_define, "^R1[4|5]", deprecated_crypto}, + {platform_define, "^((1[8|9])|2)", rand_module}, no_debug_info, warnings_as_errors ]}, @@ -1,5 +1,5 @@ [{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.0.4">>},0}, {<<"cf">>,{pkg,<<"cf">>,<<"0.2.1">>},0}, - {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.19.0">>},0}, + {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.21.0">>},0}, {<<"getopt">>,{pkg,<<"getopt">>,<<"0.8.2">>},0}, {<<"providers">>,{pkg,<<"providers">>,<<"1.6.0">>},0}]. |