aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpriv/templates/extended_bin18
1 files changed, 16 insertions, 2 deletions
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin
index 2580dcc..e3b8f1a 100755
--- a/priv/templates/extended_bin
+++ b/priv/templates/extended_bin
@@ -294,8 +294,22 @@ export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH"
ERTS_LIB_DIR="$(dirname "$ERTS_DIR")/lib"
VMARGS_PATH=$(add_path vm.args $VMARGS_PATH)
-# Extract the target node name from node.args
-NAME_ARG=$(egrep '^-s?name' "$VMARGS_PATH" || true)
+# Extract the target node name from vm.args or referenced args_files
+NAME_ARG=$(awk 'function find_name(file) {
+ while ((getline line<file)>0) {
+ if (line~/^-args_file\s+/) {
+ gsub(/^-args_file\s+/, "", line)
+ find_name(line)
+ }
+ else if (line~/^-s?name\s+/) {
+ print line
+ exit
+ }
+ }
+}
+{
+ find_name(FILENAME)
+}' "$VMARGS_PATH")
# Perform replacement of variables in ${NAME_ARG}
NAME_ARG=$(eval echo "${NAME_ARG}")