Github messages for voidlinux
 help / color / mirror / Atom feed
From: classabbyamp <classabbyamp@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] openjdk-common: update to 2.
Date: Sat, 06 Jan 2024 22:45:39 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-48092@inbox.vuxu.org> (raw)

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

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages binjava
https://github.com/void-linux/void-packages/pull/48092

openjdk-common: update to 2.
adds /usr/bin/java script to bridge the gap between fully profile-based and fully /usr/bin symlinks

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**


A patch file from https://github.com/void-linux/void-packages/pull/48092.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-binjava-48092.patch --]
[-- Type: text/x-diff, Size: 2473 bytes --]

From 69b40f6bb307dc9677d72805f93236f9bbd82e79 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 6 Jan 2024 16:44:19 -0500
Subject: [PATCH] openjdk-common: update to 2.

adds /usr/bin/java script to bridge the gap between fully profile-based
and fully /usr/bin symlinks
---
 srcpkgs/openjdk-common/files/java.sh    | 11 +++++++++++
 srcpkgs/openjdk-common/files/profile.sh |  4 ++--
 srcpkgs/openjdk-common/template         |  3 ++-
 3 files changed, 15 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/openjdk-common/files/java.sh

diff --git a/srcpkgs/openjdk-common/files/java.sh b/srcpkgs/openjdk-common/files/java.sh
new file mode 100644
index 0000000000000..3454478eadecb
--- /dev/null
+++ b/srcpkgs/openjdk-common/files/java.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# allows scripts that assume java exists on PATH to work
+# and helps users use java without logging out/in for the profile script
+die() {
+	echo "java: $@" >&2
+	exit 1
+}
+. /etc/profile.d/jdk.sh
+[ -d "$JAVA_HOME" ] || die "/usr/lib/jvm/default-jre not found. Check xbps-alternatives -lg java"
+[ -x "$JAVA_HOME"/bin/java ] || die "$JAVA_HOME/bin/java does not exist or is not executable"
+exec "$JAVA_HOME"/bin/java "$@"
diff --git a/srcpkgs/openjdk-common/files/profile.sh b/srcpkgs/openjdk-common/files/profile.sh
index e9c9a6042eea7..88d482ebe33a2 100644
--- a/srcpkgs/openjdk-common/files/profile.sh
+++ b/srcpkgs/openjdk-common/files/profile.sh
@@ -1,7 +1,7 @@
 # only modify the environment if an openjdk*-jre package is installed
-if [ -e "/usr/lib/jvm/default-jre" ]; then
+if [ -d "/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
+	if [ -d "/usr/lib/jvm/default-jdk" ]; then
 		export JAVA_HOME="/usr/lib/jvm/default-jdk"
 	else
 		export JAVA_HOME="/usr/lib/jvm/default-jre"
diff --git a/srcpkgs/openjdk-common/template b/srcpkgs/openjdk-common/template
index e0d3d53d55004..8b0748efaad54 100644
--- a/srcpkgs/openjdk-common/template
+++ b/srcpkgs/openjdk-common/template
@@ -1,6 +1,6 @@
 # Template file for 'openjdk-common'
 pkgname=openjdk-common
-version=1
+version=2
 revision=1
 short_desc="Common files for OpenJDK packages"
 maintainer="classabbyamp <void@placeviolette.net>"
@@ -9,4 +9,5 @@ homepage="https://www.voidlinux.org"
 
 do_install() {
 	vinstall "${FILESDIR}"/profile.sh 644 /etc/profile.d jdk.sh
+	vbin "${FILESDIR}"/java.sh java
 }

             reply	other threads:[~2024-01-06 21:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-06 21:45 classabbyamp [this message]
2024-01-06 22:05 ` [PR PATCH] [Merged]: " classabbyamp

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=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-48092@inbox.vuxu.org \
    --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).