Gentoo Archives: gentoo-commits

From: Florian Schmaus <flow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eselect-java:java-vm-update commit in: src/modules/
Date: Fri, 24 Jun 2022 07:56:35
Message-Id: 1656057101.341c97956e32325cdf25f65005900f3272fa9fec.flow@gentoo
1 commit: 341c97956e32325cdf25f65005900f3272fa9fec
2 Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 24 07:49:14 2022 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 24 07:51:41 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=341c9795
7
8 Decide based on the UID if system or user VM should be modified
9
10 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
11
12 src/modules/java-vm.eselect.in | 18 +++++++++++++++++-
13 1 file changed, 17 insertions(+), 1 deletion(-)
14
15 diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
16 index c7d5a82..d51b200 100644
17 --- a/src/modules/java-vm.eselect.in
18 +++ b/src/modules/java-vm.eselect.in
19 @@ -116,7 +116,7 @@ describe_set_parameters() {
20 }
21
22 do_set() {
23 - local usage="Usage <user|system> <VM>"
24 + local usage="Usage [<user|system>] <VM>"
25 local ifunset=0
26
27 if [[ ${1} == "--if-unset" ]]; then
28 @@ -124,6 +124,22 @@ do_set() {
29 shift
30 fi
31
32 + # Automatically decide, based in the invoking user's UID, if the
33 + # user or system Java VM should be modified.
34 + if [[ ${#} -eq 1 ]]; then
35 + if ! is_number "${1}"; then
36 + die -q ${usage}
37 + fi
38 +
39 + local kind
40 + if [[ ${UID} -eq 0 ]]; then
41 + kind="system"
42 + else
43 + kind="user"
44 + fi
45 + set -- ${kind} ${@}
46 + fi
47 +
48 if [[ ${#} != 2 ]]; then
49 die -q ${usage}
50 elif [[ ${1} == "system" ]]; then