fix(upgrade): ensure use correct no_dot_erlang.boot
This commit is contained in:
parent
5a9e8a23b3
commit
a88c42cf82
|
@ -144,17 +144,28 @@ relup_test(){
|
|||
./emqx/bin/emqx start || ( tail emqx/log/emqx.log.1 && exit 1 )
|
||||
./emqx/bin/emqx_ctl status
|
||||
./emqx/bin/emqx versions
|
||||
OldVsn="$(./emqx/bin/emqx eval 'Versions=[{S, V} || {_,V,_, S} <- release_handler:which_releases()],
|
||||
Current = proplists:get_value(current, Versions, proplists:get_value(permanent, Versions)),
|
||||
io:format("~s", [Current])')"
|
||||
cp "${PACKAGE_PATH}/${EMQX_NAME}"-*-"${TARGET_VERSION}-${ARCH}".zip ./emqx/releases
|
||||
./emqx/bin/emqx install "${TARGET_VERSION}"
|
||||
[ "$(./emqx/bin/emqx versions |grep permanent | awk '{print $2}')" = "${TARGET_VERSION}" ] || exit 1
|
||||
export EMQX_WAIT_FOR_STOP=300
|
||||
./emqx/bin/emqx_ctl status
|
||||
|
||||
# also test remove old rel
|
||||
./emqx/bin/emqx uninstall "$OldVsn"
|
||||
|
||||
# check emqx still runs
|
||||
./emqx/bin/emqx ping
|
||||
|
||||
if ! ./emqx/bin/emqx stop; then
|
||||
cat emqx/log/erlang.log.1 || true
|
||||
cat emqx/log/emqx.log.1 || true
|
||||
echo "failed to stop emqx"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf emqx
|
||||
done
|
||||
fi
|
||||
|
|
|
@ -111,6 +111,7 @@ uninstall({_RelName, NameTypeArg, NodeName, Cookie}, Opts) ->
|
|||
TargetNode = start_distribution(NodeName, NameTypeArg, Cookie),
|
||||
WhichReleases = which_releases(TargetNode),
|
||||
Version = proplists:get_value(version, Opts),
|
||||
ensure_latest_boot_file(current_release_version(TargetNode)),
|
||||
case proplists:get_value(Version, WhichReleases) of
|
||||
undefined ->
|
||||
?INFO("Release ~s is already uninstalled.", [Version]);
|
||||
|
@ -362,6 +363,9 @@ permafy(TargetNode, RelName, Vsn) ->
|
|||
[{ok, _} = file:copy(filename:join(["bin", File++"-"++Vsn]),
|
||||
filename:join(["bin", File]))
|
||||
|| File <- Scripts],
|
||||
|
||||
ensure_latest_boot_file(Vsn),
|
||||
|
||||
%% update the vars
|
||||
UpdatedVars = io_lib:format("REL_VSN=\"~s\"~nERTS_VSN=\"~s\"~n", [Vsn, erts_vsn()]),
|
||||
file:write_file(filename:absname(filename:join(["releases", "emqx_vars"])), UpdatedVars, [append]).
|
||||
|
@ -458,3 +462,9 @@ str(A) when is_binary(A) ->
|
|||
binary_to_list(A);
|
||||
str(A) when is_list(A) ->
|
||||
(A).
|
||||
|
||||
%%% For otp upgrade, the boot file need match the otp version
|
||||
%%% This is for emqx cli tool
|
||||
ensure_latest_boot_file(Vsn) ->
|
||||
{ok, _} = file:copy(filename:join(["releases", Vsn, "no_dot_erlang.boot"]),
|
||||
filename:join(["bin", "no_dot_erlang.boot"])).
|
||||
|
|
Loading…
Reference in New Issue