diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index 6c09296f5..c98ef1cb8 100755 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -647,17 +647,21 @@ fi # Extract the target cookie # Do this before relx_get_nodename so we can use it and not create a ~/.erlang.cookie -COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)" -DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie" -if [ -z "$COOKIE_ARG" ]; then - if [ -f "$DEFAULT_COOKIE_FILE" ]; then - COOKIE="$(cat "$DEFAULT_COOKIE_FILE")" +if [ -n "$ERLX_OVERRIDE_COOKIE" ]; then + COOKIE="$ERLX_OVERRIDE_COOKIE" +else + COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)" + DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie" + if [ -z "$COOKIE_ARG" ]; then + if [ -f "$DEFAULT_COOKIE_FILE" ]; then + COOKIE="$(cat "$DEFAULT_COOKIE_FILE")" + else + echo "No cookie is set or found. This limits the scripts functionality, installing, upgrading, rpc and getting a list of versions will not work." + fi else - echo "No cookie is set or found. This limits the scripts functionality, installing, upgrading, rpc and getting a list of versions will not work." + # Extract cookie name from COOKIE_ARG + COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')" fi -else - # Extract cookie name from COOKIE_ARG - COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')" fi # User can specify an sname without @hostname