diff options
Diffstat (limited to 'priv/templates')
-rwxr-xr-x | priv/templates/bin | 10 | ||||
-rw-r--r-- | priv/templates/bin_windows | 7 | ||||
-rwxr-xr-x | priv/templates/extended_bin | 35 |
3 files changed, 47 insertions, 5 deletions
diff --git a/priv/templates/bin b/priv/templates/bin index 0b439c3..8bb6890 100755 --- a/priv/templates/bin +++ b/priv/templates/bin @@ -32,6 +32,11 @@ find_sys_config() { __possible_sys="$REL_DIR/sys.config" if [ -f "$__possible_sys" ]; then SYS_CONFIG="$__possible_sys" + else + if [ -L "$__possible_sys".orig ]; then + mv "$__possible_sys".orig "$__possible_sys" + SYS_CONFIG="$__possible_sys" + fi fi } @@ -39,6 +44,11 @@ find_vm_args() { __possible_vm_args="$REL_DIR/vm.args" if [ -f "$__possible_vm_args" ]; then VM_ARGS="$__possible_vm_args" + else + if [ -L "$__possible_vm_args".orig ]; then + mv "$__possible_vm_args".orig "$__possible_vm_args" + VM_ARGS="$__possible_vm_args" + fi fi } diff --git a/priv/templates/bin_windows b/priv/templates/bin_windows index 3466292..7b1d4d8 100644 --- a/priv/templates/bin_windows +++ b/priv/templates/bin_windows @@ -73,6 +73,13 @@ cd %rootdir% @if exist "%possible_sys%" ( set sys_config=-config "%possible_sys%" ) +@if exist "%possible_sys%".orig ( + ren "%possible_sys%".orig "%possible_sys%" + set sys_config=-config "%possible_sys%" +) +@if exist "%rel_dir%\vm.args".orig ( + ren "%rel_dir%\vm.args" ".orig %rel_dir%\vm.args" +) @goto :eof :: set boot_script variable diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index b752229..3c406aa 100755 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -98,9 +98,23 @@ if [ -z "$VMARGS_PATH" ]; then fi fi +orig_vmargs_path="$VMARGS_PATH.orig" 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 + #Make sure we don't break dev mode by keeping the symbolic link to + #the user's vm.args + if [ ! -L "$orig_vmargs_path" ]; then + #we're in copy mode, rename the vm.args file to vm.args.orig + mv "$VMARGS_PATH" "$orig_vmargs_path" + fi + + awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < "$orig_vmargs_path" > "$VMARGS_PATH" + else + #We don't need to replace env. vars, just rename the + #symlink vm.args.orig to vm.args, and keep it as a + #symlink. + if [ -L "$orig_vmargs_path" ]; then + mv "$orig_vmargs_path" "$VMARGS_PATH" + fi fi # Make sure log directory exists @@ -115,12 +129,23 @@ if [ -z "$RELX_CONFIG_PATH" ]; then fi fi +orig_relx_config_path="$RELX_CONFIG_PATH.orig" if [ $RELX_REPLACE_OS_VARS ]; then - #Make sure we don't break dev mode by keeping the symbolic link - orig_relx_config_path="$RELX_CONFIG_PATH.orig" - mv "$RELX_CONFIG_PATH" "$orig_relx_config_path" + #Make sure we don't break dev mode by keeping the symbolic link to + #the user's sys.config + if [ ! -L "$orig_relx_config_path" ]; then + #We're in copy mode, rename sys.config to sys.config.orig + mv "$RELX_CONFIG_PATH" "$orig_relx_config_path" + fi awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < "$orig_relx_config_path" > "$RELX_CONFIG_PATH" + else + #We don't need to replace env. vars, just rename the + #symlink sys.config.orig to sys.config. Keep it as + #a symlink. + if [ -L "$orig_relx_config_path" ]; then + mv "$orig_relx_config_path" "$RELX_CONFIG_PATH" + fi fi # Extract the target node name from node.args |