mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
4d8f770624
Use dynamic Rebar configuration Make iconv dependency optional Disable transient_supervisors compile option Add hipe compilation support Only compile ibrowse and lhttpc when needed Make it possible to generate an OTP application release Add --enable-debug compile option Add --enable-all compiler option Add --enable-tools configure option Add --with-erlang configure option. Add --enable-erlang-version-check configure option. Add lager support Improve the test suite
45 lines
1.7 KiB
Erlang
45 lines
1.7 KiB
Erlang
#!/usr/bin/env escript
|
|
%%! -noshell -noinput
|
|
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
|
|
%% ex: ft=erlang ts=4 sw=4 et
|
|
|
|
-define(TIMEOUT, 60000).
|
|
-define(INFO(Fmt,Args), io:format(Fmt,Args)).
|
|
|
|
main([NodeName, Cookie, ReleasePackage]) ->
|
|
TargetNode = start_distribution(NodeName, Cookie),
|
|
{ok, Vsn} = rpc:call(TargetNode, release_handler, unpack_release,
|
|
[ReleasePackage], ?TIMEOUT),
|
|
?INFO("Unpacked Release ~p~n", [Vsn]),
|
|
{ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
|
|
check_install_release, [Vsn], ?TIMEOUT),
|
|
{ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
|
|
install_release, [Vsn], ?TIMEOUT),
|
|
?INFO("Installed Release ~p~n", [Vsn]),
|
|
ok = rpc:call(TargetNode, release_handler, make_permanent, [Vsn], ?TIMEOUT),
|
|
?INFO("Made Release ~p Permanent~n", [Vsn]);
|
|
main(_) ->
|
|
init:stop(1).
|
|
|
|
start_distribution(NodeName, Cookie) ->
|
|
MyNode = make_script_node(NodeName),
|
|
{ok, _Pid} = net_kernel:start([MyNode, shortnames]),
|
|
erlang:set_cookie(node(), list_to_atom(Cookie)),
|
|
TargetNode = make_target_node(NodeName),
|
|
case {net_kernel:hidden_connect_node(TargetNode),
|
|
net_adm:ping(TargetNode)} of
|
|
{true, pong} ->
|
|
ok;
|
|
{_, pang} ->
|
|
io:format("Node ~p not responding to pings.\n", [TargetNode]),
|
|
init:stop(1)
|
|
end,
|
|
TargetNode.
|
|
|
|
make_target_node(Node) ->
|
|
[_, Host] = string:tokens(atom_to_list(node()), "@"),
|
|
list_to_atom(lists:concat([Node, "@", Host])).
|
|
|
|
make_script_node(Node) ->
|
|
list_to_atom(lists:concat([Node, "_upgrader_", os:getpid()])).
|