mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-16 22:05:29 +02:00
Support to update modules in R14B04 and higher
This commit is contained in:
parent
3cd9cd0e36
commit
6575f899b6
|
@ -41,7 +41,7 @@ update() ->
|
||||||
case update_info() of
|
case update_info() of
|
||||||
{ok, Dir, _UpdatedBeams, _Script, LowLevelScript, _Check} ->
|
{ok, Dir, _UpdatedBeams, _Script, LowLevelScript, _Check} ->
|
||||||
Eval =
|
Eval =
|
||||||
release_handler_1:eval_script(
|
eval_script(
|
||||||
LowLevelScript, [],
|
LowLevelScript, [],
|
||||||
[{ejabberd, "", filename:join(Dir, "..")}]),
|
[{ejabberd, "", filename:join(Dir, "..")}]),
|
||||||
?INFO_MSG("eval: ~p~n", [Eval]),
|
?INFO_MSG("eval: ~p~n", [Eval]),
|
||||||
|
@ -58,7 +58,7 @@ update(ModulesToUpdate) ->
|
||||||
[A || A <- UpdatedBeamsAll, B <- ModulesToUpdate, A == B],
|
[A || A <- UpdatedBeamsAll, B <- ModulesToUpdate, A == B],
|
||||||
{_, LowLevelScript, _} = build_script(Dir, UpdatedBeamsNow),
|
{_, LowLevelScript, _} = build_script(Dir, UpdatedBeamsNow),
|
||||||
Eval =
|
Eval =
|
||||||
release_handler_1:eval_script(
|
eval_script(
|
||||||
LowLevelScript, [],
|
LowLevelScript, [],
|
||||||
[{ejabberd, "", filename:join(Dir, "..")}]),
|
[{ejabberd, "", filename:join(Dir, "..")}]),
|
||||||
?INFO_MSG("eval: ~p~n", [Eval]),
|
?INFO_MSG("eval: ~p~n", [Eval]),
|
||||||
|
@ -67,6 +67,16 @@ update(ModulesToUpdate) ->
|
||||||
{error, Reason}
|
{error, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
%% OTP R14B03 and older provided release_handler_1:eval_script/3
|
||||||
|
%% But OTP R14B04 and newer provide release_handler_1:eval_script/5
|
||||||
|
eval_script(Script, Apps, LibDirs) ->
|
||||||
|
case lists:member({eval_script, 5}, release_handler_1:module_info(exports)) of
|
||||||
|
true ->
|
||||||
|
release_handler_1:eval_script(Script, Apps, LibDirs, [], []);
|
||||||
|
false ->
|
||||||
|
release_handler_1:eval_script(Script, Apps, LibDirs)
|
||||||
|
end.
|
||||||
|
|
||||||
%% Get information about the modified modules
|
%% Get information about the modified modules
|
||||||
update_info() ->
|
update_info() ->
|
||||||
Dir = filename:dirname(code:which(ejabberd)),
|
Dir = filename:dirname(code:which(ejabberd)),
|
||||||
|
@ -134,6 +144,10 @@ build_script(Dir, UpdatedBeams) ->
|
||||||
?DEBUG("script: ~p~n", [Script]),
|
?DEBUG("script: ~p~n", [Script]),
|
||||||
?DEBUG("low level script: ~p~n", [LowLevelScript]),
|
?DEBUG("low level script: ~p~n", [LowLevelScript]),
|
||||||
?DEBUG("check: ~p~n", [Check]);
|
?DEBUG("check: ~p~n", [Check]);
|
||||||
|
{ok, []} ->
|
||||||
|
?DEBUG("script: ~p~n", [Script]),
|
||||||
|
?DEBUG("low level script: ~p~n", [LowLevelScript]),
|
||||||
|
?DEBUG("check: ~p~n", [Check]);
|
||||||
_ ->
|
_ ->
|
||||||
?ERROR_MSG("script: ~p~n", [Script]),
|
?ERROR_MSG("script: ~p~n", [Script]),
|
||||||
?ERROR_MSG("low level script: ~p~n", [LowLevelScript]),
|
?ERROR_MSG("low level script: ~p~n", [LowLevelScript]),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user