summaryrefslogtreecommitdiff
path: root/priv/templates/simplenode.install_upgrade.escript
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-09-16 19:36:04 -0500
committerTristan Sloughter <t@crashfast.com>2014-09-16 19:36:04 -0500
commit884d298291e64fad99f096ee82018b568e0985f2 (patch)
tree2251d30abe9bf5890d2fd7506e74979149307df4 /priv/templates/simplenode.install_upgrade.escript
parent71d9500997930a43f30bce863e05f3dbaa4fd3f4 (diff)
update templating
Diffstat (limited to 'priv/templates/simplenode.install_upgrade.escript')
-rwxr-xr-xpriv/templates/simplenode.install_upgrade.escript52
1 files changed, 0 insertions, 52 deletions
diff --git a/priv/templates/simplenode.install_upgrade.escript b/priv/templates/simplenode.install_upgrade.escript
deleted file mode 100755
index 0d4cbe3..0000000
--- a/priv/templates/simplenode.install_upgrade.escript
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env escript
-%%! -noshell -noinput
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ft=erlang ts=4 sw=4 et
-
--define(TIMEOUT, 60000).
--define(INFO(Fmt,Args), io:format(Fmt,Args)).
-
-%% TODO: This script currently does NOT support slim releases.
-%% Necessary steps to upgrade a slim release are as follows:
-%% 1. unpack relup archive manually
-%% 2. copy releases directory and necessary libraries
-%% 3. using release_hander:set_unpacked/2 .
-%% For more details, see https://github.com/rebar/rebar/pull/52
-%% and https://github.com/rebar/rebar/issues/202
-
-main([NodeName, Cookie, ReleasePackage]) ->
- TargetNode = start_distribution(NodeName, Cookie),
- {ok, Vsn} = rpc:call(TargetNode, release_handler, unpack_release,
- [ReleasePackage], ?TIMEOUT),
- ?INFO("Unpacked Release ~p~n", [Vsn]),
- {ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
- check_install_release, [Vsn], ?TIMEOUT),
- {ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
- install_release, [Vsn], ?TIMEOUT),
- ?INFO("Installed Release ~p~n", [Vsn]),
- ok = rpc:call(TargetNode, release_handler, make_permanent, [Vsn], ?TIMEOUT),
- ?INFO("Made Release ~p Permanent~n", [Vsn]);
-main(_) ->
- init:stop(1).
-
-start_distribution(NodeName, Cookie) ->
- MyNode = make_script_node(NodeName),
- {ok, _Pid} = net_kernel:start([MyNode, shortnames]),
- erlang:set_cookie(node(), list_to_atom(Cookie)),
- TargetNode = make_target_node(NodeName),
- case {net_kernel:hidden_connect_node(TargetNode),
- net_adm:ping(TargetNode)} of
- {true, pong} ->
- ok;
- {_, pang} ->
- io:format("Node ~p not responding to pings.\n", [TargetNode]),
- init:stop(1)
- end,
- TargetNode.
-
-make_target_node(Node) ->
- [_, Host] = string:tokens(atom_to_list(node()), "@"),
- list_to_atom(lists:concat([Node, "@", Host])).
-
-make_script_node(Node) ->
- list_to_atom(lists:concat([Node, "_upgrader_", os:getpid()])).