Skip to content

Commit b5d90ed

Browse files
committed
Refuse to install openHAB 5 if no Java 21 is available (after potential Java install)
Signed-off-by: Markus Storm <markus.storm@gmx.net>
1 parent 658e387 commit b5d90ed

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

functions/openhab.bash

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ openhab_setup() {
3131
local installVersion
3232
local repo
3333
local successText
34+
local noJVMText="We were unable to install/upgrade your system to openHAB 5.\\nThis requires Java version 21, and we have been unable to identify and install a suitable Java JVM package for your hardware-OS combo."
3435
local ohPkgName="openhab"
3536

3637
if [[ $1 == "snapshot" || $1 == "unstable" ]]; then
@@ -58,7 +59,7 @@ openhab_setup() {
5859
fi
5960

6061
# date needs to be > Apr 1, 24 for openhab repo signing key to be valid
61-
# note RPi have no RTC
62+
# note RPis have no real time clock
6263
if [[ $(date +%y%m%d) -lt 240401 ]]; then
6364
systemctl stop systemd-timesyncd
6465
timedatectl set-time "2024-04-09 00:00:00"
@@ -89,6 +90,19 @@ openhab_setup() {
8990
fi
9091
fi
9192

93+
javaVersionNeu="$(java -version |& head -1 | awk -F'"' '{ print $2 }' | cut -d '.' -f1)"
94+
if [[ $openhabMajorVersion = 5 ]] && [[ $javaVersionNeu -lt 21 ]] ; then
95+
echo "FAILED (could not install required Java 21)"
96+
if [[ -n $INTERACTIVE ]]; then
97+
unset DEBIAN_FRONTEND
98+
if [[ "$(getconf LONG_BIT)" == "32" ]]; then
99+
noJVMText+="\\nThere is currently no suitable JVM package for ARM processors that works with a 32 bit OS image."
100+
fi
101+
whiptail --title "Operation failed!" --msgbox "$noJVMText" 9 80
102+
fi
103+
return 1
104+
fi
105+
92106
if [[ -n $openhabVersion ]]; then
93107
installVersion="${ohPkgName}=${openhabVersion} ${ohPkgName}-addons=${openhabVersion}"
94108
else

0 commit comments

Comments
 (0)