java 24 from temurin

This commit is contained in:
Zsolt Ero
2025-09-18 02:36:45 +02:00
parent 454b38a111
commit 13cdc09eef
3 changed files with 47 additions and 6 deletions

View File

@@ -109,8 +109,7 @@ def tile_gen(
if reinstall:
c.sudo('rm -rf /data/ofm')
# prepare_shared(c)
prepare_shared(c)
prepare_tile_gen(c, enable_cron=cron)

42
ssh_lib/java.py Normal file
View File

@@ -0,0 +1,42 @@
from ssh_lib.utils import (
apt_get_install,
apt_get_purge,
apt_get_update,
put_str,
sudo_cmd,
ubuntu_codename,
)
JAVA_VER = 24
def java(c):
"""Install OpenJDK from Eclipse Adoptium."""
# remove old Ubuntu version of OpenJDK
apt_get_purge(c, 'openjdk* temurin*')
# Download and install the Eclipse Adoptium GPG key
sudo_cmd(
c,
'wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public '
'| gpg --dearmor '
'| tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null',
)
# Get the Ubuntu codename
codename = ubuntu_codename(c)
# Configure the Eclipse Adoptium apt repository
put_str(
c,
'/etc/apt/sources.list.d/adoptium.list',
f'deb https://packages.adoptium.net/artifactory/deb {codename} main',
)
# Update package list and install Temurin JDK
apt_get_update(c)
apt_get_install(c, f'temurin-{JAVA_VER}-jdk')
# Verify installation
c.run('java -version')

View File

@@ -1,9 +1,10 @@
from ssh_lib import PLANETILER_BIN, PLANETILER_SRC
from ssh_lib.java import java
from ssh_lib.utils import apt_get_install, apt_get_update, exists, sudo_cmd
PLANETILER_COMMIT = '33b22c516e21cfbce6168ecba1c74486dc95d589' # last good
# PLANETILER_COMMIT = 'cc769c4f3c8d0ada8be7e650d3afdb4e92cbd3f2' # main, not working
# PLANETILER_COMMIT = '33b22c516e21cfbce6168ecba1c74486dc95d589' # last good
PLANETILER_COMMIT = 'cc769c4f3c8d0ada8be7e650d3afdb4e92cbd3f2' # main, not working
PLANETILER_PATH = f'{PLANETILER_BIN}/planetiler.jar'
@@ -13,8 +14,7 @@ def install_planetiler(c):
print('planetiler exists, skipping')
return
apt_get_update(c)
apt_get_install(c, 'openjdk-21-jre-headless')
java(c)
c.sudo('rm -rf /root/.m2') # cleaning maven cache
c.sudo(f'rm -rf {PLANETILER_BIN} {PLANETILER_SRC}')