aboutsummaryrefslogtreecommitdiffstats
path: root/priv
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2017-03-14 09:24:47 -0700
committerGitHub <[email protected]>2017-03-14 09:24:47 -0700
commit8f0e68e1897132b50f8578df5f7e635d18ad4070 (patch)
treeb933d8c5f9f00c824b7acfe468f416d127ae2ef1 /priv
parentd64be0acf966c25a68fce6b37788ff3fb8a5373b (diff)
parentd6066c58bb39b3495873c9d3c1337d16f102bbd1 (diff)
downloadrelx-8f0e68e1897132b50f8578df5f7e635d18ad4070.tar.gz
relx-8f0e68e1897132b50f8578df5f7e635d18ad4070.tar.bz2
relx-8f0e68e1897132b50f8578df5f7e635d18ad4070.zip
Merge pull request #563 from lrascao/feature/replace_os_vars_app_config_test
Only use multi-node sys.config if requested when replacing OS vars
Diffstat (limited to 'priv')
-rwxr-xr-xpriv/templates/extended_bin17
1 files changed, 14 insertions, 3 deletions
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin
index 88d2cab..c069249 100755
--- a/priv/templates/extended_bin
+++ b/priv/templates/extended_bin
@@ -193,7 +193,11 @@ make_out_file_path() {
PFX=$(echo $IN | awk '{sub(/\.[^.]+$/, "", $0)}1')
SFX=$(echo $FILE | awk -F . '{if (NF>1) print $NF}')
- echo "${PFX}.${NAME}.${SFX}"
+ if [ $RELX_MULTI_NODE ]; then
+ echo "${PFX}.${NAME}.${SFX}"
+ else
+ echo "${PFX}.${SFX}"
+ fi
}
# Replace environment variables
@@ -233,11 +237,18 @@ check_replace_os_vars() {
# apply the environment variable substitution to $IN_FILE_PATH
# the result is saved to $OUT_FILE_PATH
- replace_os_vars "$IN_FILE_PATH" "$OUT_FILE_PATH"
+ # if they are both the same, then ensure that we don't clobber
+ # the file by saving a backup with the .orig extension
+ if [ "$IN_FILE_PATH" = "$OUT_FILE_PATH" ]; then
+ cp "$IN_FILE_PATH" "$ORIG_FILE_PATH"
+ replace_os_vars "$ORIG_FILE_PATH" "$OUT_FILE_PATH"
+ else
+ replace_os_vars "$IN_FILE_PATH" "$OUT_FILE_PATH"
+ fi
else
# If vm.arg.orig or sys.config.orig is present then use that
if [ -f "$ORIG_FILE_PATH" ]; then
- OUT_FILE_PATH="$ORIG_FILE_PATH"
+ cp "$ORIG_FILE_PATH" "$OUT_FILE_PATH"
fi
fi
echo $OUT_FILE_PATH