aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--priv/templates/extended_bin.dtl15
-rw-r--r--priv/templates/install_upgrade_escript.dtl2
-rw-r--r--src/rlx_dscv_util.erl7
-rw-r--r--src/rlx_prv_assembler.erl6
4 files changed, 15 insertions, 15 deletions
diff --git a/priv/templates/extended_bin.dtl b/priv/templates/extended_bin.dtl
index 59cf692..26c18b6 100644
--- a/priv/templates/extended_bin.dtl
+++ b/priv/templates/extended_bin.dtl
@@ -29,13 +29,18 @@ find_erts_dir() {
relx_rem_sh() {
# Generate a unique id used to allow multiple remsh to the same node
# transparently
- id="remsh$(date +%s`@`echo "$NAME" | awk -F@ '{print $2}')"
+ id="remsh$(relx_gen_id)-${NAME}"
# Setup remote shell command to control node
exec "$BINDIR/erl" "$NAME_TYPE" "$id" -remsh "$NAME" -boot start_clean \
-setcookie "$COOKIE"
}
+# Generate a random id
+relx_gen_id() {
+ od -X /dev/urandom | head -n1 | cut -d ' ' -f2
+}
+
# Control a node
relx_nodetool() {
command="$1"; shift
@@ -51,12 +56,12 @@ relx_start_command() {
# Use $CWD/vm.args if exists, otherwise releases/APP_VSN/vm.args, or else etc/vm.args
if [ -z "$VMARGS_PATH" ]; then
- if [ -e "$RELEASE_ROOT_DIR/vm.args" ]; then
+ if [ -f "$RELEASE_ROOT_DIR/vm.args" ]; then
VMARGS_PATH="$RELEASE_ROOT_DIR/vm.args"
USE_DIR="$RELEASE_ROOT_DIR"
else
USE_DIR="$REL_DIR"
- if [ -e "$REL_DIR/vm.args" ]; then
+ if [ -f "$REL_DIR/vm.args" ]; then
VMARGS_PATH="$REL_DIR/vm.args"
else
VMARGS_PATH="$REL_DIR/vm.args"
@@ -69,10 +74,10 @@ mkdir -p "$RUNNER_LOG_DIR"
# Use releases/VSN/sys.config if it exists otherwise use etc/app.config
if [ -z "$CONFIG_PATH" ]; then
- if [ -e "$USE_DIR/sys.config" ]; then
+ if [ -f "$USE_DIR/sys.config" ]; then
CONFIG_PATH="$USE_DIR/sys.config"
else
- if [ -e "$REL_DIR/sys.config" ]; then
+ if [ -f "$REL_DIR/sys.config" ]; then
CONFIG_PATH="$REL_DIR/sys.config"
else
CONFIG_PATH="$REL_DIR/app.config"
diff --git a/priv/templates/install_upgrade_escript.dtl b/priv/templates/install_upgrade_escript.dtl
index 7c331aa..dce2e11 100644
--- a/priv/templates/install_upgrade_escript.dtl
+++ b/priv/templates/install_upgrade_escript.dtl
@@ -3,7 +3,7 @@
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et
--define(TIMEOUT, 60000).
+-define(TIMEOUT, 300000).
-define(INFO(Fmt,Args), io:format(Fmt,Args)).
%% Upgrades, to a new tar.gz release
diff --git a/src/rlx_dscv_util.erl b/src/rlx_dscv_util.erl
index a4a265c..aa642b8 100644
--- a/src/rlx_dscv_util.erl
+++ b/src/rlx_dscv_util.erl
@@ -110,11 +110,8 @@ discover_dir(ProcessDir, File, symlink) ->
discover_real_symlink_dir(ProcessDir, File)
end.
-discover_real_symlink_dir(ProcessDir, File) ->
- {ok, CurCwd} = file:get_cwd(),
- ok = file:set_cwd(File),
- {ok, ActualRealDir} = file:get_cwd(),
- ok = file:set_cwd(CurCwd),
+discover_real_symlink_dir(ProcessDir, File) ->
+ {ok, ActualRealDir} = file:read_link(File),
case lists:prefix(iolist_to_list(filename:absname(ActualRealDir)),
iolist_to_list(filename:absname(File))) of
true ->
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index d7bf3f1..47d96aa 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -316,9 +316,7 @@ write_bin_file(State, Release, OutputDir, RelDir) ->
NodeTool = filename:join([BinDir, "nodetool"]),
InstallUpgrade = filename:join([BinDir, "install_upgrade.escript"]),
ok = file:write_file(NodeTool, NodeToolFile),
- ok = file:write_file(InstallUpgrade, InstallUpgradeFile),
- ok = file:change_mode(NodeTool, 8#755),
- ok = file:change_mode(InstallUpgrade, 8#755);
+ ok = file:write_file(InstallUpgrade, InstallUpgradeFile);
false ->
ok
end,
@@ -702,7 +700,7 @@ ensure_not_exist(RelConfPath) ->
erl_script(ErtsVsn) ->
render(erl_script_dtl, [{erts_vsn, ErtsVsn}]).
-
+
bin_file_contents(OsFamily, RelName, RelVsn, ErtsVsn, ErlOpts) ->
Template = case OsFamily of
unix -> bin_dtl;