openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
818 stars 251 forks source link

add Zulu JDK 21 installation on 64bit #1861

Closed holgerfriedrich closed 2 months ago

holgerfriedrich commented 2 months ago

Requires a native 64 bit image, running a 64 bit kernel with 32-bit OS is not sufficient.

I have been working to make OH compile an run with Java21 openhab/openhab-distro#1590. Not all of the required PRs have been merged, so we are not yet there. This PR allows to install Java21 on x64/aarch64 systems.

Running the snapshot distro without modification is not yet possible, still waiting for the PR openhab/openhab-distro#1640 to be merged.

holgerfriedrich commented 2 months ago

Hi @mstormi, I think the checks are already there, shared by the Zulu11-64 and Zulu 21-64 targets. if is_aarch64 || is_x86_64 && [[ $(getconf LONG_BIT) == 64 ]]; then The check with getconf is really necessary - I had my RPI image that showed aarch64 but LONG_BIT 32 with a 32 bit userland.

If the prerequisites are not met, the common error reaction is to show a message in interactive setup (good) or to install Zulu-32 in the interactive case (maybe not so well suited). As the code for the fallback is shared and there is no Java 21 32bit available anyway, this might be ok.

WDYT?

Btw: anything wrong with my change which causes the bats test to fail, or are the tests affected by something else?

holgerfriedrich commented 2 months ago

Thanks, Markus

mstormi commented 2 months ago

Hi Holger,

would you consider adding openjdk21 as PR, too ? In short

echo "deb http://ftp.de.debian.org/debian/ testing main" >> /etc/apt/sources.list.d/raspi.list
apt-get install  openjdk-21-jre-headless
[16:06:02] root@openhabian:/etc/apt/sources.list.d# java -version
openjdk version "21.0.2" 2024-01-16
OpenJDK Runtime Environment (build 21.0.2+13-Debian-2)
OpenJDK 64-Bit Server VM (build 21.0.2+13-Debian-2, mixed mode, sharing)
[16:06:13] root@openhabian:/etc/apt/sources.list.d# getconf LONG_BIT
64