New package: openjdk-common-1

Replaces the xbps trigger that added the profile script for openjdk,
which was really a mistake.

Instead of using alternative groups for specific JRE/JDK binaries, use
two symlinks: /usr/lib/jvm/default-jdk and /usr/lib/jvm/default-jre,
which point to /usr/lib/jvm/${version}. Prefer default-jdk to default-jre,
and just add them to PATH and MANPATH instead of putting things in /usr/bin.
This commit is contained in:
classabbyamp 2023-12-21 17:32:52 -05:00 committed by classabbyamp
parent 1c592ad18e
commit dcbd1f1067
4 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,9 @@
#!/bin/sh
case "$ACTION" in
pre)
# remove the openjdk.sh from xbps-triggers
if [ -e "./etc/profile.d/openjdk.sh" ]; then
rm "./etc/profile.d/openjdk.sh"
fi
;;
esac

View file

@ -0,0 +1,2 @@
The way the default OpenJDK version is selected has changed.
You may need to re-login for this change to take effect.

View file

@ -0,0 +1,12 @@
# only modify the environment if an openjdk*-jre package is installed
if [ -e "/usr/lib/jvm/default-jre" ]; then
# if an openjdk* package is installed, prefer it to the selected jre
if [ -e "/usr/lib/jvm/default-jdk" ]; then
export JAVA_HOME="/usr/lib/jvm/default-jdk"
else
export JAVA_HOME="/usr/lib/jvm/default-jre"
fi
# append the select jdk and jre bin and man dirs to the relevant PATHs
export PATH="$PATH:/usr/lib/jvm/default-jdk/bin:/usr/lib/jvm/default-jre/bin"
export MANPATH="$MANPATH:/usr/lib/jvm/default-jdk/man:/usr/lib/jvm/default-jre/man"
fi

View file

@ -0,0 +1,12 @@
# Template file for 'openjdk-common'
pkgname=openjdk-common
version=1
revision=1
short_desc="Common files for OpenJDK packages"
maintainer="classabbyamp <void@placeviolette.net>"
license="Public Domain"
homepage="https://www.voidlinux.org"
do_install() {
vinstall "${FILESDIR}"/profile.sh 644 /etc/profile.d jdk.sh
}