mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-22 04:45:37 +00:00
Use bundled JDK in Sys V init (#45593)
This commit addresses an issue when trying to using Elasticsearch on systems with Sys V init and the bundled JDK was not being used. Instead, we were still inadvertently trying to fallback on the path. This commit removes that fallback as that is against our intentions for 7.x where we only support the bundled JDK or an explicit JDK via JAVA_HOME.
This commit is contained in:
parent
6b72d42cb8
commit
ec4182590f
@ -81,16 +81,16 @@ if [ ! -x "$DAEMON" ]; then
|
||||
fi
|
||||
|
||||
checkJava() {
|
||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
if [ ! -z "${JAVA_HOME}" ]; then
|
||||
JAVA="${JAVA_HOME}"/bin/java
|
||||
else
|
||||
JAVA="${ES_HOME}"/jdk/bin/java
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "could not find java in JAVA_HOME or bundled at ${JAVA}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
@ -68,16 +68,16 @@ if [ ! -x "$exec" ]; then
|
||||
fi
|
||||
|
||||
checkJava() {
|
||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
if [ ! -z "${JAVA_HOME}" ]; then
|
||||
JAVA="${JAVA_HOME}"/bin/java
|
||||
else
|
||||
JAVA="${ES_HOME}"/jdk/bin/java
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "could not find java in JAVA_HOME or bundled at ${JAVA}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -136,6 +136,25 @@ public abstract class PackageTestCase extends PackagingTestCase {
|
||||
assertRunsWithJavaHome();
|
||||
}
|
||||
|
||||
public void test33RunsIfJavaNotOnPath() throws Exception {
|
||||
assumeThat(distribution().hasJdk, is(true));
|
||||
|
||||
final Result readlink = sh.run("readlink /usr/bin/java");
|
||||
boolean unlinked = false;
|
||||
try {
|
||||
sh.run("unlink /usr/bin/java");
|
||||
unlinked = true;
|
||||
|
||||
startElasticsearch(sh);
|
||||
runElasticsearchTests();
|
||||
stopElasticsearch(sh);
|
||||
} finally {
|
||||
if (unlinked) {
|
||||
sh.run("ln -sf " + readlink.stdout.trim() + " /usr/bin/java");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void test42BundledJdkRemoved() throws Exception {
|
||||
assumeThat(installation, is(notNullValue()));
|
||||
assumeThat(distribution().hasJdk, is(true));
|
||||
|
Loading…
x
Reference in New Issue
Block a user