aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates/install_upgrade_escript.dtl
diff options
context:
space:
mode:
Diffstat (limited to 'priv/templates/install_upgrade_escript.dtl')
-rw-r--r--priv/templates/install_upgrade_escript.dtl44
1 files changed, 22 insertions, 22 deletions
diff --git a/priv/templates/install_upgrade_escript.dtl b/priv/templates/install_upgrade_escript.dtl
index 6dcddb3..7c331aa 100644
--- a/priv/templates/install_upgrade_escript.dtl
+++ b/priv/templates/install_upgrade_escript.dtl
@@ -14,64 +14,64 @@ main([RelName, NodeName, Cookie, VersionArg]) ->
case proplists:get_value(Version, WhichReleases) of
undefined ->
%% not installed, so unpack tarball:
- ?INFO(\"Release ~s not found, attempting to unpack releases/~s/~s.tar.gz~n\",[Version,Version,RelName]),
- ReleasePackage = Version ++ \"/\" ++ RelName,
+ ?INFO("Release ~s not found, attempting to unpack releases/~s/~s.tar.gz~n",[Version,Version,RelName]),
+ ReleasePackage = Version ++ "/" ++ RelName,
case rpc:call(TargetNode, release_handler, unpack_release,
[ReleasePackage], ?TIMEOUT) of
{ok, Vsn} ->
- ?INFO(\"Unpacked successfully: ~p~n\", [Vsn]),
+ ?INFO("Unpacked successfully: ~p~n", [Vsn]),
install_and_permafy(TargetNode, RelName, Vsn);
{error, UnpackReason} ->
print_existing_versions(TargetNode),
- ?INFO(\"Unpack failed: ~p~n\",[UnpackReason]),
+ ?INFO("Unpack failed: ~p~n",[UnpackReason]),
erlang:halt(2)
end;
old ->
%% no need to unpack, has been installed previously
- ?INFO(\"Release ~s is marked old, switching to it.~n\",[Version]),
+ ?INFO("Release ~s is marked old, switching to it.~n",[Version]),
install_and_permafy(TargetNode, RelName, Version);
unpacked ->
- ?INFO(\"Release ~s is already unpacked, now installing.~n\",[Version]),
+ ?INFO("Release ~s is already unpacked, now installing.~n",[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]),
+ ?INFO("Release ~s is already installed and current. Making permanent.~n",[Version]),
permafy(TargetNode, RelName, Version);
permanent ->
- ?INFO(\"Release ~s is already installed, and set permanent.~n\",[Version])
+ ?INFO("Release ~s is already installed, and set permanent.~n",[Version])
end;
main(_) ->
erlang:halt(1).
parse_version(V) when is_list(V) ->
- hd(string:tokens(V,\"/\")).
+ hd(string:tokens(V,"/")).
install_and_permafy(TargetNode, RelName, Vsn) ->
case rpc:call(TargetNode, release_handler, check_install_release, [Vsn], ?TIMEOUT) of
{ok, _OtherVsn, _Desc} ->
ok;
{error, Reason} ->
- ?INFO(\"ERROR: release_handler:check_install_release failed: ~p~n\",[Reason]),
+ ?INFO("ERROR: release_handler:check_install_release failed: ~p~n",[Reason]),
erlang:halt(3)
end,
case rpc:call(TargetNode, release_handler, install_release, [Vsn], ?TIMEOUT) of
{ok, _, _} ->
- ?INFO(\"Installed Release: ~s~n\", [Vsn]),
+ ?INFO("Installed Release: ~s~n", [Vsn]),
permafy(TargetNode, RelName, Vsn),
ok;
{error, {no_such_release, Vsn}} ->
VerList =
iolist_to_binary(
- [io_lib:format(\"* ~s\t~s~n\",[V,S]) || {V,S} <- which_releases(TargetNode)]),
- ?INFO(\"Installed versions:~n~s\", [VerList]),
- ?INFO(\"ERROR: Unable to revert to '~s' - not installed.~n\", [Vsn]),
+ [io_lib:format("* ~s\t~s~n",[V,S]) || {V,S} <- which_releases(TargetNode)]),
+ ?INFO("Installed versions:~n~s", [VerList]),
+ ?INFO("ERROR: Unable to revert to '~s' - not installed.~n", [Vsn]),
erlang:halt(2)
end.
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]),
+ file:copy(filename:join(["bin", RelName++"-"++Vsn]),
+ filename:join(["bin", RelName])),
+ ?INFO("Made release permanent: ~p~n", [Vsn]),
ok.
which_releases(TargetNode) ->
@@ -80,9 +80,9 @@ which_releases(TargetNode) ->
print_existing_versions(TargetNode) ->
VerList = iolist_to_binary([
- io_lib:format(\"* ~s\t~s~n\",[V,S])
+ io_lib:format("* ~s\t~s~n",[V,S])
|| {V,S} <- which_releases(TargetNode) ]),
- ?INFO(\"Installed versions:~n~s\", [VerList]).
+ ?INFO("Installed versions:~n~s", [VerList]).
start_distribution(NodeName, Cookie) ->
MyNode = make_script_node(NodeName),
@@ -94,7 +94,7 @@ start_distribution(NodeName, Cookie) ->
{true, pong} ->
ok;
{_, pang} ->
- io:format(\"Node ~p not responding to pings.\n\", [TargetNode]),
+ io:format("Node ~p not responding to pings.\n", [TargetNode]),
erlang:halt(1)
end,
{ok, Cwd} = file:get_cwd(),
@@ -102,5 +102,5 @@ start_distribution(NodeName, Cookie) ->
TargetNode.
make_script_node(Node) ->
- [Name, Host] = string:tokens(Node, \"@\"),
- list_to_atom(lists:concat([Name, \"_upgrader_\", os:getpid(), \"@\", Host])).
+ [Name, Host] = string:tokens(Node, "@"),
+ list_to_atom(lists:concat([Name, "_upgrader_", os:getpid(), "@", Host])).