aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates
diff options
context:
space:
mode:
authorLuis Rascão <[email protected]>2017-11-17 21:20:35 +0000
committerGitHub <[email protected]>2017-11-17 21:20:35 +0000
commita3c7263856236539278a8019fded8f66e36938f7 (patch)
treef03e9b577c54cd748ab68b7864143498a95b9351 /priv/templates
parentc8e597d300b7f3bc79b7971e955b9b06a90d803b (diff)
parent69dafa2b0a22ca4f266f730342ff3d6b1802767b (diff)
downloadrelx-a3c7263856236539278a8019fded8f66e36938f7.tar.gz
relx-a3c7263856236539278a8019fded8f66e36938f7.tar.bz2
relx-a3c7263856236539278a8019fded8f66e36938f7.zip
Merge pull request #624 from ferd/relup-windows
Fix release upgrades on Windows
Diffstat (limited to 'priv/templates')
-rw-r--r--priv/templates/extended_bin_windows12
-rw-r--r--priv/templates/install_upgrade_escript9
2 files changed, 15 insertions, 6 deletions
diff --git a/priv/templates/extended_bin_windows b/priv/templates/extended_bin_windows
index d0c41d8..5f22e4f 100644
--- a/priv/templates/extended_bin_windows
+++ b/priv/templates/extended_bin_windows
@@ -48,6 +48,12 @@
set node_name=%%J
)
+@if "-sname" == "%node_type%" (
+ set hostname="%COMPUTERNAME%"
+) else (
+ set hostname="%COMPUTERNAME%.%USERDNSDOMAIN%
+)
+
:: Extract cookie from vm.args
@for /f "usebackq tokens=1-2" %%I in (`findstr /b \-setcookie "%vm_args%"`) do @(
set cookie=%%J
@@ -160,9 +166,7 @@ set start_erl=%erts_dir%\bin\start_erl.exe
set description=Erlang node %node_name% in %rootdir%
@if "" == "%2" (
:: Install the service
- %erlsrv% add %service_name% %node_type% "%node_name%" -c "%description%" ^
- -w "%rootdir%" -m "%start_erl%" -args "%args%" ^
- -stopaction "init:stop()."
+ %erlsrv% add %service_name% %node_type% "%node_name%" -c "%description%" -w "%rootdir%" -m "%start_erl%" -args "%args%" -stopaction "init:stop()."
) else (
:: relup and reldown
goto relup
@@ -193,7 +197,7 @@ set description=Erlang node %node_name% in %rootdir%
set ERRORLEVEL=1
exit /b %ERRORLEVEL%
)
-@%escript% "%rootdir%/bin/install_upgrade.escript" "install" "%rel_name%" "%node_name%" "%cookie%" "%2"
+@%escript% "%rootdir%/bin/install_upgrade.escript" "install" "{'%rel_name%', \"%node_type%\", '%node_name%@%hostname%', '%cookie%'}" "%2" "%3"
@goto :eof
:: Start a console
diff --git a/priv/templates/install_upgrade_escript b/priv/templates/install_upgrade_escript
index 47521c6..d704136 100644
--- a/priv/templates/install_upgrade_escript
+++ b/priv/templates/install_upgrade_escript
@@ -207,7 +207,12 @@ find_and_link_release_package(Version, RelName) ->
ok = filelib:ensure_dir(filename:join([filename:dirname(ReleaseLink), "dummy"])),
%% create the symlink pointing to the full path name of the
%% release package we found
- ok = file:make_symlink(filename:absname(Filename), ReleaseLink),
+ case file:make_symlink(filename:absname(Filename), ReleaseLink) of
+ ok ->
+ ok;
+ {error, eperm} -> % windows!
+ {ok,_} = file:copy(filename:absname(Filename), ReleaseLink)
+ end,
{Filename, ReleaseHandlerPackageLink}
end.
@@ -311,7 +316,7 @@ start_distribution(TargetNode, NameTypeArg, Cookie) ->
{true, pong} ->
ok;
{_, pang} ->
- io:format("Node ~p not responding to pings.\n", [TargetNode]),
+ ?INFO("Node ~p not responding to pings.\n", [TargetNode]),
erlang:halt(1)
end,
{ok, Cwd} = file:get_cwd(),