Fix system java detection

This commit is contained in:
Jiří Štefka 2023-02-27 03:22:55 +01:00
parent 2845e4cd4f
commit 5b637cf84d
3 changed files with 10 additions and 10 deletions

@ -86,17 +86,17 @@ function check_script_java {
# Get the system Java version # Get the system Java version
function check_java_exec { function check_java_exec {
# Check if java is installed # Check if java is installed
if ! command -v java &> /dev/null if ! command -v java &> /dev/null; then
then java_version=false
java_version=false else
fi
# If java is installed, get the version (the java_version won't be 0)
if [[ $java_version != false ]]; then
# Get the current Java version and extract the build number # Get the current Java version and extract the build number
java_version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '{print $1}') java_version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '{print $1}')
fi fi
if [[ $java_version != $required_java ]]; then
java_version=false
fi
} }
# Get the required Java version for the Minecraft version # Get the required Java version for the Minecraft version

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
EXTRA_SCRIPTS_VERSION="v1.1.6" EXTRA_SCRIPTS_VERSION="v1.1.7"

@ -8,7 +8,7 @@ set -e
# and acknowledge the original script and author. # # and acknowledge the original script and author. #
############################################################################################################# #############################################################################################################
CURRENT_SCRIPT_VERSION="v1.1.6" CURRENT_SCRIPT_VERSION="v1.1.7"
# -------------------------------------------------- # --------------------------------------------------
# You shouldn't need to change anything in this file # You shouldn't need to change anything in this file