From ba619d9dd990c6b642da69cf937dacb1ce42605c Mon Sep 17 00:00:00 2001 From: "David N. Welton" Date: Tue, 17 Feb 2015 17:34:30 +0100 Subject: Use 'erl' to determine Erlang hostname rather than nodetool --- priv/templates/extended_bin.dtl | 45 +++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'priv/templates') 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) -- cgit v1.2.3