aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src/systools_rc.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sasl/src/systools_rc.erl')
-rw-r--r--lib/sasl/src/systools_rc.erl45
1 files changed, 30 insertions, 15 deletions
diff --git a/lib/sasl/src/systools_rc.erl b/lib/sasl/src/systools_rc.erl
index 6f01901fbc..c16f6aa845 100644
--- a/lib/sasl/src/systools_rc.erl
+++ b/lib/sasl/src/systools_rc.erl
@@ -54,6 +54,7 @@
%% {sync_nodes, Id, Nodes}
%% {apply, {M, F, A}}
%% restart_new_emulator
+%% restart_emulator
%%-----------------------------------------------------------------
%% High-level instructions that contain dependencies
@@ -145,7 +146,7 @@ translate_merged_script(Mode, Script, Appls, PreAppls) ->
Appls),
Before3 = merge_load_object_code(Before2),
- {Before4,After4} = sort_restart_new_emulator(Mode,Before3,After2),
+ {Before4,After4} = sort_emulator_restart(Mode,Before3,After2),
NewScript = Before4 ++ [point_of_no_return | After4],
check_syntax(NewScript),
@@ -702,23 +703,37 @@ mlo([{load_object_code, {Lib, LibVsn, Mods}} | T]) ->
mlo([]) -> [].
%%-----------------------------------------------------------------
-%% RESTART DIFF EMULATOR
+%% RESTART EMULATOR
%% -----------------------------------------------------------------
%% -----------------------------------------------------------------
-%% Check if a diff_vsn_restart_new_emulator instruction exists (i.e. if the
-%% emulator version is changed). If so, this must be done first for
-%% upgrade and last for downgrade.
+%% Check if there are any 'restart_new_emulator' instructions (i.e. if
+%% the emulator or core application version is changed). If so, this
+%% must be done first for upgrade and last for downgrade.
+%% Check if there are any 'restart_emulator' instructions, if so
+%% remove all and place one the end.
%% -----------------------------------------------------------------
-sort_restart_new_emulator(Mode,Before,After) ->
- case lists:delete(diff_vsn_restart_new_emulator,After) of
- After ->
- {Before,After};
- NewAfter when Mode==up ->
- {[restart_new_emulator|Before],NewAfter};
- NewAfter when Mode==dn ->
- {Before,NewAfter++[restart_new_emulator]}
- end.
+sort_emulator_restart(Mode,Before,After) ->
+ {Before1,After1} =
+ case filter_out(restart_new_emulator, After) of
+ After ->
+ {Before,After};
+ A1 when Mode==up ->
+ {[restart_new_emulator|Before],A1};
+ A1 when Mode==dn ->
+ {Before,A1++[restart_emulator]}
+ end,
+ After2 =
+ case filter_out(restart_emulator, After1) of
+ After1 ->
+ After1;
+ A2 ->
+ A2++[restart_emulator]
+ end,
+ {Before1,After2}.
+
+filter_out(What,List) ->
+ lists:filter(fun(X) when X=:=What -> false; (_) -> true end, List).
%%-----------------------------------------------------------------
%% SYNTAX CHECK
@@ -839,7 +854,7 @@ check_op({apply, {M, F, A}}) ->
check_func(F),
check_args(A);
check_op(restart_new_emulator) -> ok;
-check_op(diff_vsn_restart_new_emulator) -> ok;
+check_op(restart_emulator) -> ok;
check_op(X) -> throw({error, {bad_instruction, X}}).
check_mod(Mod) when is_atom(Mod) -> ok;