#!/bin/sh -e

echo "Executing entrypoint_debug"

# This is documented here:
# https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines

if ! whoami &>/dev/null; then
  if [ -w /etc/passwd ]; then
    echo "${USER_NAME:-activemq-artemis-operator}:x:$(id -u):$(id -g):${USER_NAME:-activemq-artemis-operator} user:${HOME}:/sbin/nologin" >> /etc/passwd
  fi
fi

echo "exec ${HOME}/dlv exec --headless=true --listen=0.0.0.0:4000 --api-version=2 ${OPERATOR} $@"
exec ${HOME}/dlv exec --headless=true --listen=0.0.0.0:4000 --api-version=2 ${OPERATOR} $@
