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 98accb9 commit a497e54
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions functions/menu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Menu 50 provides options to backup and restore either your openHAB configuration
show_main_menu() {
local choice
local version
local jdkBin
local javaVersion


Expand Down Expand Up @@ -75,8 +74,7 @@ show_main_menu() {
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)"
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
if [[ $javaVersion -lt 17 ]] ; then
update_config_java "17"
Expand Down

0 comments on commit a497e54

Please sign in to comment.