diff options
author | David N. Welton <[email protected]> | 2015-02-17 17:34:30 +0100 |
---|---|---|
committer | David N. Welton <[email protected]> | 2015-02-17 17:34:30 +0100 |
commit | ba619d9dd990c6b642da69cf937dacb1ce42605c (patch) | |
tree | e5b236d40f20c4fab8cfe57b0c36b68124f522af /priv/templates/extended_bin.dtl | |
parent | a2e8eaa4fb6307e0d71ba932de6eb9378ddae937 (diff) | |
download | relx-ba619d9dd990c6b642da69cf937dacb1ce42605c.tar.gz relx-ba619d9dd990c6b642da69cf937dacb1ce42605c.tar.bz2 relx-ba619d9dd990c6b642da69cf937dacb1ce42605c.zip |
Use 'erl' to determine Erlang hostname rather than nodetool
Diffstat (limited to 'priv/templates/extended_bin.dtl')
-rw-r--r-- | priv/templates/extended_bin.dtl | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/priv/templates/extended_bin.dtl b/priv/templates/extended_bin.dtl index ffff615..9a3ab61 100644 --- a/priv/templates/extended_bin.dtl +++ b/priv/templates/extended_bin.dtl @@ -38,6 +38,11 @@ relx_get_pid() { fi } +relx_get_longname() { + id="longname$(relx_gen_id)-${NAME}" + "$BINDIR/erl" -boot start_clean -eval 'io:format("~s~n", [node()])' -noshell -s init stop -name $id | sed -e 's/.*@//g' +} + # Connect to a remote node relx_rem_sh() { # Generate a unique id used to allow multiple remsh to the same node @@ -123,26 +128,6 @@ fi NAME_TYPE="$(echo "$NAME_ARG" | awk '{print $1}')" NAME="$(echo "$NAME_ARG" | awk '{print $2}')" -# User can specify an sname without @hostname -# This will fail when creating remote shell -# So here we check for @ and add @hostname if missing -case $NAME in - *@*) - # Nothing to do - ;; - *) - # Add @hostname - case $NAME_TYPE in - -sname) - NAME=$NAME@`hostname -s` - ;; - -name) - NAME=$NAME@`hostname -f` - ;; - esac - ;; -esac - PIPE_DIR="${PIPE_DIR:-/tmp/erl_pipes/$NAME/}" # Extract the target cookie @@ -165,6 +150,26 @@ ERTS_LIB_DIR="$ERTS_DIR/../lib" cd "$ROOTDIR" +# User can specify an sname without @hostname +# This will fail when creating remote shell +# So here we check for @ and add @hostname if missing +case $NAME in + *@*) + # Nothing to do + ;; + *) + # Add @hostname + case $NAME_TYPE in + -sname) + NAME=$NAME@`hostname -s` + ;; + -name) + NAME=$NAME@$(relx_get_longname) + ;; + esac + ;; +esac + # Check the first argument for instructions case "$1" in start|start_boot) |