aboutsummaryrefslogtreecommitdiffstats
path: root/priv
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2015-03-31 17:51:36 -0500
committerTristan Sloughter <[email protected]>2015-03-31 17:51:36 -0500
commitedb75261f3ee1ef5f088da869f2bc7a61ef0601d (patch)
tree54a64a96a816aaf9c5deb5b719944e5d9200accc /priv
parentb2b7c4aff99fd8e2c4ec7053aa382b4b356fecf5 (diff)
parentba619d9dd990c6b642da69cf937dacb1ce42605c (diff)
downloadrelx-edb75261f3ee1ef5f088da869f2bc7a61ef0601d.tar.gz
relx-edb75261f3ee1ef5f088da869f2bc7a61ef0601d.tar.bz2
relx-edb75261f3ee1ef5f088da869f2bc7a61ef0601d.zip
Merge pull request #316 from davidw/fix_hostname_lookup2
Use 'erl' to determine Erlang hostname rather than nodetool
Diffstat (limited to 'priv')
-rw-r--r--priv/templates/extended_bin.dtl45
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)