diff options
author | Evax Software <[email protected]> | 2013-10-15 17:04:40 +0200 |
---|---|---|
committer | Evax Software <[email protected]> | 2013-10-15 17:23:16 +0200 |
commit | bf34727c720ba722153225ff8b7bcdefc463b487 (patch) | |
tree | df867dec640b2ec7180e783d5deff496c7cb1b7d | |
parent | b6c988c9e00d3b006840f46d874539b776d183b5 (diff) | |
download | relx-bf34727c720ba722153225ff8b7bcdefc463b487.tar.gz relx-bf34727c720ba722153225ff8b7bcdefc463b487.tar.bz2 relx-bf34727c720ba722153225ff8b7bcdefc463b487.zip |
Ensure scripts are updated on upgrade for cold starts
-rw-r--r-- | src/rlx_prv_assembler.erl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl index 5389fde..09b3281 100644 --- a/src/rlx_prv_assembler.erl +++ b/src/rlx_prv_assembler.erl @@ -972,7 +972,7 @@ main([RelName, NodeName, Cookie, VersionArg]) -> [ReleasePackage], ?TIMEOUT) of {ok, Vsn} -> ?INFO(\"Unpacked successfully: ~p~n\", [Vsn]), - install_and_permafy(TargetNode, Vsn); + install_and_permafy(TargetNode, RelName, Vsn); {error, UnpackReason} -> print_existing_versions(TargetNode), ?INFO(\"Unpack failed: ~p~n\",[UnpackReason]), @@ -981,13 +981,13 @@ main([RelName, NodeName, Cookie, VersionArg]) -> old -> %% no need to unpack, has been installed previously ?INFO(\"Release ~s is marked old, switching to it.~n\",[Version]), - install_and_permafy(TargetNode, Version); + install_and_permafy(TargetNode, RelName, Version); unpacked -> ?INFO(\"Release ~s is already unpacked, now installing.~n\",[Version]), - install_and_permafy(TargetNode, Version); + install_and_permafy(TargetNode, RelName, Version); current -> %% installed and in-use, just needs to be permanent ?INFO(\"Release ~s is already installed and current. Making permanent.~n\",[Version]), - permafy(TargetNode, Version); + permafy(TargetNode, RelName, Version); permanent -> ?INFO(\"Release ~s is already installed, and set permanent.~n\",[Version]) end; @@ -997,7 +997,7 @@ main(_) -> parse_version(V) when is_list(V) -> hd(string:tokens(V,\"/\")). -install_and_permafy(TargetNode, Vsn) -> +install_and_permafy(TargetNode, RelName, Vsn) -> case rpc:call(TargetNode, release_handler, check_install_release, [Vsn], ?TIMEOUT) of {ok, _OtherVsn, _Desc} -> ok; @@ -1008,7 +1008,7 @@ install_and_permafy(TargetNode, Vsn) -> case rpc:call(TargetNode, release_handler, install_release, [Vsn], ?TIMEOUT) of {ok, _, _} -> ?INFO(\"Installed Release: ~s~n\", [Vsn]), - permafy(TargetNode, Vsn), + permafy(TargetNode, RelName, Vsn), ok; {error, {no_such_release, Vsn}} -> VerList = @@ -1019,8 +1019,10 @@ install_and_permafy(TargetNode, Vsn) -> erlang:halt(2) end. -permafy(TargetNode, Vsn) -> +permafy(TargetNode, RelName, Vsn) -> ok = rpc:call(TargetNode, release_handler, make_permanent, [Vsn], ?TIMEOUT), + file:copy(filename:join([\"bin\", RelName++\"-\"++Vsn]), + filename:join([\"bin\", RelName])), ?INFO(\"Made release permanent: ~p~n\", [Vsn]), ok. |