aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2016-06-16 18:46:31 -0500
committerGitHub <[email protected]>2016-06-16 18:46:31 -0500
commit9168eab9d949cb5fb3fe09b9e73cf404295e97ff (patch)
treebba6f246581bf3952fce4f07261a026135be276a /priv/templates
parent38bf6186db7518e5b2eae9b51cc1096362697128 (diff)
parent7de3ed18361decc9ca3c1c0fe95b4f40a149154c (diff)
downloadrelx-9168eab9d949cb5fb3fe09b9e73cf404295e97ff.tar.gz
relx-9168eab9d949cb5fb3fe09b9e73cf404295e97ff.tar.bz2
relx-9168eab9d949cb5fb3fe09b9e73cf404295e97ff.zip
Merge pull request #488 from soranoba/feature/default_cookiev3.20.0
If cookie is not exist in vm.args, it use the cookie in ~/.erlang.cookie
Diffstat (limited to 'priv/templates')
-rwxr-xr-xpriv/templates/extended_bin15
1 files changed, 10 insertions, 5 deletions
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin
index c2515ba..7a9f0c7 100755
--- a/priv/templates/extended_bin
+++ b/priv/templates/extended_bin
@@ -163,14 +163,19 @@ PIPE_DIR="${PIPE_DIR:-/tmp/erl_pipes/$NAME/}"
# Extract the target cookie
COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)"
+DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie"
if [ -z "$COOKIE_ARG" ]; then
- echo "vm.args needs to have a -setcookie parameter."
- exit 1
+ if [ -f "$DEFAULT_COOKIE_FILE" ]; then
+ COOKIE="$(cat $DEFAULT_COOKIE_FILE)"
+ else
+ echo "vm.args needs to have a -setcookie, or $DEFAULT_COOKIE_FILE (its permission must be 400) is required."
+ exit 1
+ fi
+else
+ # Extract cookie name from COOKIE_ARG
+ COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
fi
-# Extract cookie name from COOKIE_ARG
-COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
-
find_erts_dir
export ROOTDIR="$RELEASE_ROOT_DIR"
export BINDIR="$ERTS_DIR/bin"