Skip to content

Commit

Permalink
only restart oh when java truely updated
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 a7b6b34 commit 98accb9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion functions/menu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Menu 50 provides options to backup and restore either your openHAB configuration
show_main_menu() {
local choice
local version
local jdkBin
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 +74,14 @@ 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

jdkBin="$(find /opt/jdk/*/bin ... -print -quit)"
javaVersion="$("${jdkBin}"/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 98accb9

Please sign in to comment.