mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-09-25 23:20:30 +00:00
Read the Java release from $JAVA_HOME/release so the first mc-image-helper call gets the same options (#4292)
This commit is contained in:
@@ -36,7 +36,7 @@ if isTrue "$PREFER_IPV6"; then
|
||||
export JVM_DD_OPTS
|
||||
fi
|
||||
|
||||
if (( $(mc-image-helper java-release) >= 17 )); then
|
||||
if (( $(getJavaRelease) >= 17 )); then
|
||||
MC_IMAGE_HELPER_OPTS+=" --enable-native-access=ALL-UNNAMED"
|
||||
export MC_IMAGE_HELPER_OPTS
|
||||
fi
|
||||
|
||||
@@ -646,6 +646,23 @@ function getDistro() {
|
||||
grep -E "^ID=" /etc/os-release | cut -d= -f2 | sed -e 's/"//g'
|
||||
}
|
||||
|
||||
function getJavaRelease() {
|
||||
# Read the major version from the JDK's release file so no JVM has to start;
|
||||
# the helper is the fallback when the file is missing.
|
||||
local version
|
||||
if [[ ${JAVA_HOME:-} && -f "$JAVA_HOME/release" ]]; then
|
||||
version=$(sed -n -e 's/^JAVA_VERSION="\(.*\)"$/\1/p' "$JAVA_HOME/release")
|
||||
# Java 8 and earlier report 1.8.0_312 and so on
|
||||
version=${version#1.}
|
||||
version=${version%%[._-]*}
|
||||
fi
|
||||
if isNumeric "${version:-}"; then
|
||||
echo "$version"
|
||||
else
|
||||
mc-image-helper java-release
|
||||
fi
|
||||
}
|
||||
|
||||
function checkSum() {
|
||||
local sum_file=${1?}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user