From db458c26143fa62117a1bdf10d212afa8504b0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20La=C3=9F?= Date: Mon, 8 Nov 2021 21:22:12 +0100 Subject: [PATCH] Initial commit jdk-temurin replaces jdk-adoptopenjdk. Apart from the name and the corresponding install location, change the naming scheme of the conf dir to match that of Arch's java packages. --- .SRCINFO | 57 +++++++++++++++++++ PKGBUILD | 106 +++++++++++++++++++++++++++++++++++ freedesktop-java.desktop | 9 +++ freedesktop-jconsole.desktop | 8 +++ freedesktop-jshell.desktop | 8 +++ install_jdk-temurin.sh | 50 +++++++++++++++++ 6 files changed, 238 insertions(+) create mode 100644 .SRCINFO create mode 100644 PKGBUILD create mode 100644 freedesktop-java.desktop create mode 100644 freedesktop-jconsole.desktop create mode 100644 freedesktop-jshell.desktop create mode 100644 install_jdk-temurin.sh diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..4991bf1 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,57 @@ +pkgbase = jdk-temurin + pkgdesc = Temurin (OpenJDK 17 Java binaries by Adoptium, formerly AdoptOpenJDK) + pkgver = 17.0.1.u12 + pkgrel = 1 + url = https://adoptium.net/ + install = install_jdk-temurin.sh + arch = x86_64 + license = custom + depends = java-runtime-common>=3 + depends = java-environment-common + depends = ca-certificates-utils + depends = desktop-file-utils + depends = libxrender + depends = libxtst + depends = alsa-lib + optdepends = gtk2: for the Gtk+ 2 look and feel + optdepends = gtk3: for the Gtk+ 3 look and feel + provides = java-runtime-headless=17 + provides = java-runtime-headless-openjdk=17 + provides = jre17-openjdk-headless=17.0.1.u12 + provides = jre-openjdk-headless=17.0.1.u12 + provides = java-runtime=17 + provides = java-runtime-openjdk=17 + provides = jre17-openjdk=17.0.1.u12 + provides = jre-openjdk=17.0.1.u12 + provides = java-environment=17 + provides = java-environment-openjdk=17 + provides = jdk17-openjdk=17.0.1.u12 + provides = jdk-openjdk=17.0.1.u12 + provides = openjdk17-src=17.0.1.u12 + provides = openjdk-src=17.0.1.u12 + replaces = jdk-adoptopenjdk + backup = etc/java-temurin/logging.properties + backup = etc/java-temurin/management/jmxremote.access + backup = etc/java-temurin/management/jmxremote.password.template + backup = etc/java-temurin/management/management.properties + backup = etc/java-temurin/net.properties + backup = etc/java-temurin/sdp/sdp.conf.template + backup = etc/java-temurin/security/java.policy + backup = etc/java-temurin/security/java.security + backup = etc/java-temurin/security/policy/limited/default_local.policy + backup = etc/java-temurin/security/policy/limited/default_US_export.policy + backup = etc/java-temurin/security/policy/limited/exempt_local.policy + backup = etc/java-temurin/security/policy/README.txt + backup = etc/java-temurin/security/policy/unlimited/default_local.policy + backup = etc/java-temurin/security/policy/unlimited/default_US_export.policy + backup = etc/java-temurin/sound.properties + source = https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz + source = freedesktop-java.desktop + source = freedesktop-jconsole.desktop + source = freedesktop-jshell.desktop + sha256sums = 6ea18c276dcbb8522feeebcfc3a4b5cb7c7e7368ba8590d3326c6c3efc5448b6 + sha256sums = ae076317d93a389cc0c893fd9ec6769ae860c2cc01f8c8bed3f4ee476c73e625 + sha256sums = dc278160ca7df32bcfab0a5420c09eaf6f4602d30f57b6c5bedb0f60062c5228 + sha256sums = d0913ae3b9f469f8567432b0867222d66f50008c313f5a0882d15994ba19ec01 + +pkgname = jdk-temurin diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..da3d7de --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,106 @@ +# Maintainer: Michael Lass + +# This PKGBUILD heavily borrows from java-openjdk in [extra] maintained by: +# Levente Polyak +# Guillaume ALAUX + +# This PKGBUILD is maintained on github: +# https://github.com/michaellass/AUR + +_majorver=17 +_completever=17.0.1 +_updatever=12 +pkgrel=1 +pkgver=${_completever}.u${_updatever} +_tag_ver=${_completever}+${_updatever} +[ $_majorver != $_completever ] && _versuffix=U + +pkgname=jdk-temurin +pkgdesc="Temurin (OpenJDK ${_majorver} Java binaries by Adoptium, formerly AdoptOpenJDK)" +arch=('x86_64') +url='https://adoptium.net/' +license=('custom') + +depends=('java-runtime-common>=3' 'java-environment-common' 'ca-certificates-utils' 'desktop-file-utils' 'libxrender' 'libxtst' 'alsa-lib') +optdepends=('gtk2: for the Gtk+ 2 look and feel' + 'gtk3: for the Gtk+ 3 look and feel') +provides=("java-runtime-headless=${_majorver}" + "java-runtime-headless-openjdk=${_majorver}" + "jre${_majorver}-openjdk-headless=${pkgver}" + "jre-openjdk-headless=${pkgver}" + "java-runtime=${_majorver}" + "java-runtime-openjdk=${_majorver}" + "jre${_majorver}-openjdk=${pkgver}" + "jre-openjdk=${pkgver}" + "java-environment=${_majorver}" + "java-environment-openjdk=${_majorver}" + "jdk${_majorver}-openjdk=${pkgver}" + "jdk-openjdk=${pkgver}" + "openjdk${_majorver}-src=${pkgver}" + "openjdk-src=${pkgver}") +replaces=("jdk-adoptopenjdk") +backup=(etc/java-temurin/logging.properties + etc/java-temurin/management/jmxremote.access + etc/java-temurin/management/jmxremote.password.template + etc/java-temurin/management/management.properties + etc/java-temurin/net.properties + etc/java-temurin/sdp/sdp.conf.template + etc/java-temurin/security/java.policy + etc/java-temurin/security/java.security + etc/java-temurin/security/policy/limited/default_local.policy + etc/java-temurin/security/policy/limited/default_US_export.policy + etc/java-temurin/security/policy/limited/exempt_local.policy + etc/java-temurin/security/policy/README.txt + etc/java-temurin/security/policy/unlimited/default_local.policy + etc/java-temurin/security/policy/unlimited/default_US_export.policy + etc/java-temurin/sound.properties) +install=install_jdk-temurin.sh + +source=(https://github.com/adoptium/temurin${_majorver}-binaries/releases/download/jdk-${_tag_ver/+/%2B}/OpenJDK${_majorver}${_versuffix}-jdk_x64_linux_hotspot_${_tag_ver/+/_}.tar.gz + freedesktop-java.desktop + freedesktop-jconsole.desktop + freedesktop-jshell.desktop) +sha256sums=('6ea18c276dcbb8522feeebcfc3a4b5cb7c7e7368ba8590d3326c6c3efc5448b6' + 'ae076317d93a389cc0c893fd9ec6769ae860c2cc01f8c8bed3f4ee476c73e625' + 'dc278160ca7df32bcfab0a5420c09eaf6f4602d30f57b6c5bedb0f60062c5228' + 'd0913ae3b9f469f8567432b0867222d66f50008c313f5a0882d15994ba19ec01') + +_jvmdir=/usr/lib/jvm/java-${_majorver}-temurin +_jdkdir=jdk-${_tag_ver} + +package() { + + install -dm 755 "${pkgdir}${_jvmdir}" + cp -a "${srcdir}/${_jdkdir}"/* "${pkgdir}${_jvmdir}" + + cd "${pkgdir}${_jvmdir}" + + # Conf + install -dm 755 "${pkgdir}/etc" + mv conf "${pkgdir}/etc/java-temurin" + ln -sf /etc/java-temurin conf + + # Legal + install -dm 755 "${pkgdir}/usr/share/licenses" + mv legal "${pkgdir}/usr/share/licenses/${pkgname}" + ln -sf /usr/share/licenses/${pkgname} legal + + # Man pages + for f in man/man1/*; do + install -Dm 644 "${f}" "${pkgdir}/usr/share/${f/\.1/-temurin${_majorver}.1}" + done + rm -rf man + ln -sf /usr/share/man man + + # Link JKS keystore from ca-certificates-utils + rm -f lib/security/cacerts + ln -sf /etc/ssl/certs/java/cacerts lib/security/cacerts + + # Desktop files + for f in jconsole java jshell; do + install -Dm 644 \ + "${srcdir}/freedesktop-${f}.desktop" \ + "${pkgdir}/usr/share/applications/${f}-${pkgname}.desktop" + done + +} diff --git a/freedesktop-java.desktop b/freedesktop-java.desktop new file mode 100644 index 0000000..bb51d39 --- /dev/null +++ b/freedesktop-java.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Temurin Java 17 Runtime +Comment=Temurin Java 17 Runtime +Keywords=java;runtime +Exec=/usr/lib/jvm/java-17-temurin/bin/java -jar +Terminal=false +Type=Application +MimeType=application/x-java-archive;application/java-archive;application/x-jar; +NoDisplay=true diff --git a/freedesktop-jconsole.desktop b/freedesktop-jconsole.desktop new file mode 100644 index 0000000..f6ba423 --- /dev/null +++ b/freedesktop-jconsole.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Temurin Java 17 Console +Comment=Temurin Java 17 Monitoring & Management Console +Keywords=java;console;monitoring +Exec=/usr/lib/jvm/java-17-temurin/bin/jconsole +Terminal=false +Type=Application +Categories=Application;System; diff --git a/freedesktop-jshell.desktop b/freedesktop-jshell.desktop new file mode 100644 index 0000000..dd7febc --- /dev/null +++ b/freedesktop-jshell.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Temurin Java 17 Shell +Comment=Temurin Java 17 Shell +Keywords=java;shell +Exec=/usr/lib/jvm/java-17-temurin/bin/jshell +Terminal=true +Type=Application +Categories=Application;System; diff --git a/install_jdk-temurin.sh b/install_jdk-temurin.sh new file mode 100644 index 0000000..0fa2057 --- /dev/null +++ b/install_jdk-temurin.sh @@ -0,0 +1,50 @@ +THIS_JDK='java-17-temurin' + +fix_default() { + if [ ! -x /usr/bin/java ]; then + /usr/bin/archlinux-java unset + echo "" + else + /usr/bin/archlinux-java get + fi +} + +post_install() { + default=$(fix_default) + case ${default} in + "") + /usr/bin/archlinux-java set ${THIS_JDK} + ;; + ${THIS_JDK}) + # Nothing + ;; + *) + echo "Default Java environment is already set to '${default}'" + echo "See 'archlinux-java help' to change it" + ;; + esac + + if [ ! -f /etc/ssl/certs/java/cacerts ]; then + /usr/bin/update-ca-trust + fi +} + +post_upgrade() { + default=$(fix_default) + if [ -z "${default}" ]; then + /usr/bin/archlinux-java set ${THIS_JDK} + fi + + if [ ! -f /etc/ssl/certs/java/cacerts ]; then + /usr/bin/update-ca-trust + fi +} + +pre_remove() { + if [ "x$(fix_default)" = "x${THIS_JDK}" ]; then + # Check JRE is still available + if [ -x /usr/lib/jvm/${THIS_JDK}/bin/java ]; then + /usr/bin/archlinux-java unset + fi + fi +}