xbps-triggers: add openjdk-profile trigger
This removes the need for each openjdk package to provide their own /etc/profile.d entry, and fixes the conflict caused by each providing their own.
This commit is contained in:
parent
1efee916e2
commit
7e70ea35c9
3 changed files with 48 additions and 1 deletions
|
@ -62,6 +62,7 @@ packages for XBPS, the `Void Linux` native packaging system.
|
||||||
* [kernel-hooks](#triggers_kernel_hooks)
|
* [kernel-hooks](#triggers_kernel_hooks)
|
||||||
* [mimedb](#triggers_mimedb)
|
* [mimedb](#triggers_mimedb)
|
||||||
* [mkdirs](#triggers_mkdirs)
|
* [mkdirs](#triggers_mkdirs)
|
||||||
|
* [openjdk-profile](#triggers_openjdk_profile)
|
||||||
* [pango-modules](#triggers_pango_module)
|
* [pango-modules](#triggers_pango_module)
|
||||||
* [pycompile](#triggers_pycompile)
|
* [pycompile](#triggers_pycompile)
|
||||||
* [register-shell](#triggers_register_shell)
|
* [register-shell](#triggers_register_shell)
|
||||||
|
@ -2000,6 +2001,13 @@ During removal it will delete the directory using `rmdir`.
|
||||||
To include this trigger use the `make_dirs` variable, as the trigger won't do anything
|
To include this trigger use the `make_dirs` variable, as the trigger won't do anything
|
||||||
unless it is defined.
|
unless it is defined.
|
||||||
|
|
||||||
|
<a id="triggers_openjdk_profile"></a>
|
||||||
|
#### openjdk-profile
|
||||||
|
|
||||||
|
The openjdk-profile trigger is responsible for creating an entry in /etc/profile.d that
|
||||||
|
sets the `JAVA_HOME` environment variable to the currently-selected alternative for
|
||||||
|
`/usr/bin/java` on installation. This trigger must be manually requested.
|
||||||
|
|
||||||
<a id="triggers_pango_module"></a>
|
<a id="triggers_pango_module"></a>
|
||||||
#### pango-modules
|
#### pango-modules
|
||||||
|
|
||||||
|
|
39
srcpkgs/xbps-triggers/files/openjdk-profile
Executable file
39
srcpkgs/xbps-triggers/files/openjdk-profile
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Adds an entry to /etc/profile.d for setting $JAVA_HOME.
|
||||||
|
#
|
||||||
|
# Arguments: $ACTION = [run/targets]
|
||||||
|
# $TARGET = [post-install/pre-remove]
|
||||||
|
# $PKGNAME
|
||||||
|
# $VERSION
|
||||||
|
# $UPDATE = [yes/no]
|
||||||
|
#
|
||||||
|
ACTION="$1"
|
||||||
|
TARGET="$2"
|
||||||
|
PKGNAME="$3"
|
||||||
|
VERSION="$4"
|
||||||
|
UPDATE="$5"
|
||||||
|
|
||||||
|
jdkprofile=etc/profile.d/openjdk.sh
|
||||||
|
|
||||||
|
case "$ACTION" in
|
||||||
|
targets)
|
||||||
|
echo "post-install"
|
||||||
|
;;
|
||||||
|
run)
|
||||||
|
[ -f "$jdkprofile" ] && exit 0
|
||||||
|
|
||||||
|
cat > "$jdkprofile" <<'EOF'
|
||||||
|
if _java_bin=$(readlink -e /usr/bin/java); then
|
||||||
|
_java_bin="${_java_bin%/bin/java}"
|
||||||
|
[ -d "${_java_bin}" ] && export JAVA_HOME="${JAVA_HOME:=${_java_bin}}"
|
||||||
|
fi
|
||||||
|
unset _java_bin
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
|
@ -1,6 +1,6 @@
|
||||||
# Template file for 'xbps-triggers'
|
# Template file for 'xbps-triggers'
|
||||||
pkgname=xbps-triggers
|
pkgname=xbps-triggers
|
||||||
version=0.121
|
version=0.122
|
||||||
revision=1
|
revision=1
|
||||||
bootstrap=yes
|
bootstrap=yes
|
||||||
short_desc="XBPS triggers for Void Linux"
|
short_desc="XBPS triggers for Void Linux"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue