Github messages for voidlinux
 help / color / mirror / Atom feed
From: classabbyamp <classabbyamp@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [RFC] Fix alternatives for openjdk{11,17}
Date: Tue, 28 Nov 2023 22:44:20 +0100	[thread overview]
Message-ID: <20231128214420.uWCODMfkUyyvVa7QyUrH5O7qh5L-8cZgg1Zja_M32E8@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-47416@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/47416#issuecomment-1829943383

Comment:
basically what needs to happen is:
- if only 1 JRE is installed, it should be `java` and the same for the other JRE programs
- if only 1 JDK is installed, same thing for the JDK tools
- if multiple JREs or JDKs are installed, then the `java` and JDK tools must be the same version.

but because each version is split in 2 packages, it's hard to do.

I think it may be possible to do this with a script (multicall, so it can act as any of the tools) that gets installed in /usr/bin.

Perhaps the alternative group could manage a symlink like `/usr/lib/jvm/openjdk-jre -> /usr/lib/jvm/openjdk##` and `/usr/lib/jvm/openjdk-jdk -> /usr/lib/jvm/openjdk##`, and the script wrapper ensures they're the same version.

```sh
#!/bin/sh

prog="$(basename "$0")"

if [ -e "/usr/lib/jvm/openjdk-jdk" ]; then
    if [ "$(realpath /usr/lib/jvm/openjdk-jdk)" != "$(realpath /usr/lib/jvm/openjdk-jre)" ]; then
        echo "WARNING! JDK/JRE mismatch! use xbps-alternatives to choose one"
    fi
    exec "/usr/lib/jvm/openjdk-jdk/bin/$prog" "$@"
fi

exec "/usr/lib/jvm/openjdk-jre/bin/$prog" "$@"
```
(just spitballing here)

  parent reply	other threads:[~2023-11-28 21:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-26 16:04 [PR PATCH] " tornaria
2023-11-27 12:01 ` ahesford
2023-11-27 15:34 ` classabbyamp
2023-11-28  1:59 ` tornaria
2023-11-28 14:23 ` classabbyamp
2023-11-28 14:34 ` classabbyamp
2023-11-28 18:43 ` ahesford
2023-11-28 21:44 ` classabbyamp [this message]
2023-12-23  0:23 ` tornaria
2023-12-23  0:23 ` [PR PATCH] [Closed]: " tornaria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231128214420.uWCODMfkUyyvVa7QyUrH5O7qh5L-8cZgg1Zja_M32E8@z \
    --to=classabbyamp@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).