Skip to content

Commit 06867b4

Browse files
committed
Tidy up integration of run-java/pathfinder modules
Changes were made to run-java.sh in one branch of a merge that needed to be promoted up to the new pathfinder mdouel from the other branch of a merge. Signed-off-by: Jonathan Dowland <[email protected]>
1 parent f8143c2 commit 06867b4

File tree

2 files changed

+16
-39
lines changed
  • modules
    • run/artifacts/opt/jboss/container/java/run
    • util/pathfinder/artifacts/opt/jboss/container/util/pathfinder

2 files changed

+16
-39
lines changed

modules/run/artifacts/opt/jboss/container/java/run/run-java.sh

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# Fail on a single failed command
44
set -eo pipefail
55

6+
# define default values for the location of sub-scripts. This is
7+
# necessary when the run script is used from an environment which
8+
# lacks the definitions, such as a ubi-micro-based image.
69
export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="${JBOSS_CONTAINER_UTIL_LOGGING_MODULE-/opt/jboss/container/util/logging}"
710
export JBOSS_CONTAINER_JAVA_RUN_MODULE="${JBOSS_CONTAINER_JAVA_RUN_MODULE-/opt/jboss/container/java/run}"
8-
9-
# Default the application dir to the S2I deployment dir
10-
if [ -z "$JAVA_APP_DIR" ]
11-
then JAVA_APP_DIR=/deployments
12-
fi
11+
export JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE="${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE-/opt/jboss/container/util/pathfinder}"
1312

1413
source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh"
14+
source "$JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE/pathfinder.sh"
1515

1616
# ==========================================================
1717
# Generic run script for running arbitrary Java applications
@@ -30,22 +30,6 @@ check_error() {
3030
fi
3131
}
3232

33-
load_env() {
34-
# Configuration stuff is read from this file
35-
local run_env_sh="run-env.sh"
36-
37-
# Load default default config
38-
if [ -f "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" ]; then
39-
source "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}"
40-
fi
41-
42-
# Load JAVA_APP_JAR and JAVA_LIB_DIR
43-
if [ -f "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh" ]; then
44-
source "$JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE/pathfinder.sh"
45-
setup_java_app_and_lib
46-
fi
47-
}
48-
4933
# Combine all java options
5034
get_java_options() {
5135
local jvm_opts
@@ -128,7 +112,8 @@ get_classpath() {
128112
# Start JVM
129113
startup() {
130114
# Initialize environment
131-
load_env
115+
# populates JAVA_APP_JAR and JAVA_LIB_DIR and possibly JAVA_MAIN_CLASS
116+
setup_java_app_and_lib
132117

133118
local args
134119
cd ${JAVA_APP_DIR}

modules/util/pathfinder/artifacts/opt/jboss/container/util/pathfinder/pathfinder.sh

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,17 @@ get_jar_file() {
6666
}
6767

6868
setup_java_app_and_lib() {
69-
# Configuration stuff is read from this file
70-
local run_env_sh="run-env.sh"
71-
72-
# Load default default config
73-
if [ -f "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" ]; then
74-
source "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}"
69+
# Default the application dir to the S2I deployment dir
70+
if [ -z "$JAVA_APP_DIR" ]
71+
then JAVA_APP_DIR=/deployments
7572
fi
7673

77-
# Check also $JAVA_APP_DIR. Overrides other defaults
78-
# It's valid to set the app dir in the default script
79-
if [ -z "${JAVA_APP_DIR}" ]; then
80-
# XXX: is this correct? This is defaulted above to /deployments. Should we
81-
# define a default to the old /opt/java-run?
82-
JAVA_APP_DIR="${JBOSS_CONTAINER_JAVA_RUN_MODULE}"
83-
else
84-
if [ -f "${JAVA_APP_DIR}/${run_env_sh}" ]; then
85-
source "${JAVA_APP_DIR}/${run_env_sh}"
86-
fi
74+
# application-source provided shell script that may set environment
75+
# variables
76+
if [ -f "${JAVA_APP_DIR}/run-env.sh" ]; then
77+
source "${JAVA_APP_DIR}/run-env.sh"
8778
fi
79+
8880
export JAVA_APP_DIR
8981

9082
# JAVA_LIB_DIR defaults to JAVA_APP_DIR
@@ -101,4 +93,4 @@ setup_java_app_and_lib() {
10193
else
10294
export JAVA_MAIN_CLASS
10395
fi
104-
}
96+
}

0 commit comments

Comments
 (0)