aboutsummaryrefslogtreecommitdiffstats
path: root/priv
diff options
context:
space:
mode:
Diffstat (limited to 'priv')
-rwxr-xr-xpriv/templates/extended_bin30
1 files changed, 24 insertions, 6 deletions
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin
index a06c2c3..a228413 100755
--- a/priv/templates/extended_bin
+++ b/priv/templates/extended_bin
@@ -180,9 +180,9 @@ relx_gen_id() {
relx_nodetool() {
command="$1"; shift
- escript_emulator_args $ROOTDIR/bin/nodetool
+ ESCRIPT_TMP=$(escript_emulator_args_tmp $ROOTDIR/bin/nodetool)
- "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" "$NAME_TYPE" "$NAME" \
+ "$ERTS_DIR/bin/escript" "$ESCRIPT_TMP" "$NAME_TYPE" "$NAME" \
-setcookie "$COOKIE" "$command" $@
}
@@ -248,6 +248,24 @@ escript_emulator_args() {
fi
}
+escript_emulator_args_tmp() {
+ #
+ # If the user provided $ROOTDIR/tmp directory then don't override
+ # original files of the package but use temporary files instead
+ #
+ local TMP_DIR="$ROOTDIR/tmp";
+
+ if [ -d "$TMP_DIR" ] && [ -w "$TMP_DIR" ]; then
+ local TMP_FILE="$TMP_DIR/$(basename $1)"
+ cp $1 $TMP_FILE
+ escript_emulator_args $TMP_FILE
+ echo $TMP_FILE
+ else
+ escript_emulator_args $1
+ echo $1
+ fi
+}
+
add_path() {
# Use $CWD/$1 if exists, otherwise releases/VSN/$1
IN_FILE_PATH=$2
@@ -628,9 +646,9 @@ case "$1" in
relx_run_hooks "$PRE_INSTALL_UPGRADE_HOOKS"
- escript_emulator_args $ROOTDIR/bin/install_upgrade.escript
+ ESCRIPT_TMP=$(escript_emulator_args_tmp $ROOTDIR/bin/install_upgrade.escript)
- exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \
+ exec "$BINDIR/escript" "$ESCRIPT_TMP" \
"$COMMAND" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@"
relx_run_hooks "$POST_INSTALL_UPGRADE_HOOKS"
@@ -645,9 +663,9 @@ case "$1" in
COMMAND="$1"; shift
- escript_emulator_args $ROOTDIR/bin/install_upgrade.escript
+ ESCRIPT_TMP=$(escript_emulator_args_tmp $ROOTDIR/bin/install_upgrade.escript)
- exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \
+ exec "$BINDIR/escript" "$ESCRIPT_TMP" \
"versions" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@"
;;