diff options
Diffstat (limited to 'priv/templates/extended_bin.dtl')
-rw-r--r-- | priv/templates/extended_bin.dtl | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/priv/templates/extended_bin.dtl b/priv/templates/extended_bin.dtl index 26c18b6..0b6c763 100644 --- a/priv/templates/extended_bin.dtl +++ b/priv/templates/extended_bin.dtl @@ -30,7 +30,7 @@ relx_rem_sh() { # Generate a unique id used to allow multiple remsh to the same node # transparently 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" @@ -54,37 +54,38 @@ relx_start_command() { "$START_OPTION" } -# Use $CWD/vm.args if exists, otherwise releases/APP_VSN/vm.args, or else etc/vm.args +# Use $CWD/vm.args if exists, otherwise releases/VSN/vm.args if [ -z "$VMARGS_PATH" ]; 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 [ -f "$REL_DIR/vm.args" ]; then - VMARGS_PATH="$REL_DIR/vm.args" - else - VMARGS_PATH="$REL_DIR/vm.args" - fi + USE_DIR="$REL_DIR" + VMARGS_PATH="$REL_DIR/vm.args" fi fi +if [ $RELX_REPLACE_OS_VARS ]; then + awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < $VMARGS_PATH > $VMARGS_PATH.2.config + VMARGS_PATH=$VMARGS_PATH.2.config +fi + # Make sure log directory exists mkdir -p "$RUNNER_LOG_DIR" -# Use releases/VSN/sys.config if it exists otherwise use etc/app.config if [ -z "$CONFIG_PATH" ]; then if [ -f "$USE_DIR/sys.config" ]; then CONFIG_PATH="$USE_DIR/sys.config" else - if [ -f "$REL_DIR/sys.config" ]; then - CONFIG_PATH="$REL_DIR/sys.config" - else - CONFIG_PATH="$REL_DIR/app.config" - fi + CONFIG_PATH="$REL_DIR/sys.config" fi fi +if [ $RELX_REPLACE_OS_VARS ]; then + awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < $CONFIG_PATH > $CONFIG_PATH.2.config + CONFIG_PATH=$CONFIG_PATH.2.config +fi + # Extract the target node name from node.args NAME_ARG=$(egrep '^-s?name' "$VMARGS_PATH") if [ -z "$NAME_ARG" ]; then @@ -96,6 +97,19 @@ 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 + NAME=$NAME@`hostname` + ;; +esac + # Extract the target cookie COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH")" if [ -z "$COOKIE_ARG" ]; then |