Skip to content

Commit

Permalink
midpoint.sh: reorder setenv.sh script calling to be properly processed.
Browse files Browse the repository at this point in the history
  • Loading branch information
cz-help committed Mar 10, 2022
1 parent 6095584 commit 31a6183
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions dist/src/main/bin/midpoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,20 @@ fi

mkdir -p "${MIDPOINT_HOME}/log"

# shellcheck disable=SC2034 # ORIG_JAVA_OPTS can be used used in setenv.sh lower
ORIG_JAVA_OPTS="${JAVA_OPTS:-}"
# Apply bin/setenv.sh if it exists. This setenv.sh does not depend on MIDPOINT_HOME.
# The script can either append or overwrite JAVA_OPTS, e.g. to set -Dmidpoint.nodeId.
if [[ -r "${SCRIPT_DIR}/setenv.sh" ]]; then
echo "Applying setenv.sh from ${SCRIPT_DIR} directory."
# shellcheck disable=SC1091
. "${SCRIPT_DIR}/setenv.sh"
fi

# Apply $MIDPOINT_HOME/setenv.sh if it exists. This is flexible and related to chosen MIDPOINT_HOME.
if [[ -r "${MIDPOINT_HOME}/setenv.sh" ]]; then
echo "Applying setenv.sh from ${MIDPOINT_HOME} directory."
# shellcheck disable=SC1091
. "${MIDPOINT_HOME}/setenv.sh"
fi

#############################
# Originally Docker related #
Expand Down Expand Up @@ -340,22 +352,6 @@ if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Djava.util.logging.manager=") ; then
#clean up white spaces in case of key/value removal from the original JAVA_OPTS parameter set
JAVA_OPTS="$(echo "${JAVA_OPTS:-}" | tr -s [[:space:]] " " | sed "s/^[[:space:]]//;s/[[:space:]]$//" )"

# Apply bin/setenv.sh if it exists. This setenv.sh does not depend on MIDPOINT_HOME.
# The script can either append or overwrite JAVA_OPTS, e.g. to set -Dmidpoint.nodeId.
# It can also utilize ORIG_JAVA_OPTS that is original JAVA_OPTS before running midpoint.sh.
if [[ -r "${SCRIPT_DIR}/setenv.sh" ]]; then
echo "Applying setenv.sh from ${SCRIPT_DIR} directory."
# shellcheck disable=SC1091
. "${SCRIPT_DIR}/setenv.sh"
fi

# Apply $MIDPOINT_HOME/setenv.sh if it exists. This is flexible and related to chosen MIDPOINT_HOME.
if [[ -r "${MIDPOINT_HOME}/setenv.sh" ]]; then
echo "Applying setenv.sh from ${MIDPOINT_HOME} directory."
# shellcheck disable=SC1091
. "${MIDPOINT_HOME}/setenv.sh"
fi

: "${BOOT_OUT:="${MIDPOINT_HOME}/log/midpoint.out"}"
: "${PID_FILE:="${MIDPOINT_HOME}/log/midpoint.pid"}"

Expand Down

0 comments on commit 31a6183

Please sign in to comment.