Skip to content

Commit

Permalink
check for java version before updating
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Storm <[email protected]>
  • Loading branch information
mstormi committed Feb 6, 2024
1 parent 1f9430d commit 734dc83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion functions/menu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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}"
Expand Down

0 comments on commit 734dc83

Please sign in to comment.