diff --git a/functions/menu.bash b/functions/menu.bash index cebd6634b..006a8b83b 100644 --- a/functions/menu.bash +++ b/functions/menu.bash @@ -31,6 +31,7 @@ Menu 50 provides options to backup and restore either your openHAB configuration show_main_menu() { local choice local version + local javaVersion choice=$(whiptail --title "openHABian Configuration Tool — $(get_git_revision)" --menu "Setup Options" 24 118 16 --cancel-button Exit --ok-button Execute \ @@ -72,8 +73,13 @@ show_main_menu() { whiptail --title "outdated OS" --msgbox "You are running a too old version of your Operating System.\\n\\nOpenHAB 4 and Java 17 require that you upgrade to Debian 11 (bullseye) first." 8 80 return 255 fi + + javaVersion="$(java -version |& grep -m 1 -o "[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}[\.+][0-9]\{0,3\}" | head -1|cut -d '.' -f1)" if [[ $(apt-cache madison openhab | head -n 1 | awk '{ print $3 }' | cut -d'.' -f1) = 4 ]]; then - update_config_java "17" && java_install "17" + if [[ $javaVersion -lt 17 ]] ; then + update_config_java "17" + java_install "17" + fi fi repo=$(apt-cache madison openhab | head -n 1 | awk '{ print $6 }' |cut -d'/' -f1) openhab_setup "openHAB" "${repo:-release}"