public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/eselect-java:java-vm-update commit in: /, src/modules/
@ 2022-06-24  8:17 Florian Schmaus
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Schmaus @ 2022-06-24  8:17 UTC (permalink / raw
  To: gentoo-commits

commit:     387323902452153fceb1f61e3d6bb5b3bfeba786
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 24 07:49:14 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Fri Jun 24 08:16:54 2022 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=38732390

Decide based on the UID if system or user VM should be modified

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 NEWS                           |  1 +
 src/modules/java-vm.eselect.in | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index d8ea978..52fbfe5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 NEXT:
     * Add "eselect java-vm update" (#853928)
+    * Decide on UID if system or user VM should be set
 
 0.4.3:
     * install jpackage symlink

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index c7d5a82..571b26e 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -116,7 +116,7 @@ describe_set_parameters() {
 }
 
 do_set() {
-	local usage="Usage <user|system> <VM>"
+	local usage="Usage [user|system] <VM>"
 	local ifunset=0
 
 	if [[ ${1} == "--if-unset" ]]; then
@@ -124,6 +124,22 @@ do_set() {
 		shift
 	fi
 
+	# Automatically decide, based in the invoking user's UID, if the
+	# user or system Java VM should be modified.
+	if [[ ${#} -eq 1 ]]; then
+		if ! is_number "${1}"; then
+			die -q ${usage}
+		fi
+
+		local kind
+		if [[ ${UID} -eq 0 ]]; then
+			kind="system"
+		else
+			kind="user"
+		fi
+		set -- ${kind} ${@}
+	fi
+
 	if [[ ${#} != 2 ]]; then
 		die -q ${usage}
 	elif [[ ${1} == "system" ]]; then


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/eselect-java:java-vm-update commit in: /, src/modules/
@ 2022-06-24  9:21 Florian Schmaus
  2022-06-24 10:33 ` [gentoo-commits] proj/eselect-java:master commit in: src/modules/, / Florian Schmaus
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Schmaus @ 2022-06-24  9:21 UTC (permalink / raw
  To: gentoo-commits

commit:     a9fd19b87c15c4c573ab43b8547a26d6ea894ebc
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 24 07:49:14 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Fri Jun 24 09:21:00 2022 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=a9fd19b8

Decide based on the UID if system or user VM should be modified

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 NEWS                           |  1 +
 src/modules/java-vm.eselect.in | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index d8ea978..52fbfe5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 NEXT:
     * Add "eselect java-vm update" (#853928)
+    * Decide on UID if system or user VM should be set
 
 0.4.3:
     * install jpackage symlink

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index c7d5a82..7c46ff1 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -116,7 +116,7 @@ describe_set_parameters() {
 }
 
 do_set() {
-	local usage="Usage <user|system> <VM>"
+	local usage="Usage [user|system] <VM>"
 	local ifunset=0
 
 	if [[ ${1} == "--if-unset" ]]; then
@@ -124,6 +124,18 @@ do_set() {
 		shift
 	fi
 
+	# Automatically decide, based in the invoking user's UID, if the
+	# user or system Java VM should be modified.
+	if [[ ${#} -eq 1 ]]; then
+		local kind
+		if [[ ${UID} -eq 0 ]]; then
+			kind="system"
+		else
+			kind="user"
+		fi
+		set -- ${kind} ${@}
+	fi
+
 	if [[ ${#} != 2 ]]; then
 		die -q ${usage}
 	elif [[ ${1} == "system" ]]; then


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/eselect-java:master commit in: src/modules/, /
  2022-06-24  9:21 [gentoo-commits] proj/eselect-java:java-vm-update commit in: /, src/modules/ Florian Schmaus
@ 2022-06-24 10:33 ` Florian Schmaus
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Schmaus @ 2022-06-24 10:33 UTC (permalink / raw
  To: gentoo-commits

commit:     a9fd19b87c15c4c573ab43b8547a26d6ea894ebc
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 24 07:49:14 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Fri Jun 24 09:21:00 2022 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=a9fd19b8

Decide based on the UID if system or user VM should be modified

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 NEWS                           |  1 +
 src/modules/java-vm.eselect.in | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index d8ea978..52fbfe5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 NEXT:
     * Add "eselect java-vm update" (#853928)
+    * Decide on UID if system or user VM should be set
 
 0.4.3:
     * install jpackage symlink

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index c7d5a82..7c46ff1 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -116,7 +116,7 @@ describe_set_parameters() {
 }
 
 do_set() {
-	local usage="Usage <user|system> <VM>"
+	local usage="Usage [user|system] <VM>"
 	local ifunset=0
 
 	if [[ ${1} == "--if-unset" ]]; then
@@ -124,6 +124,18 @@ do_set() {
 		shift
 	fi
 
+	# Automatically decide, based in the invoking user's UID, if the
+	# user or system Java VM should be modified.
+	if [[ ${#} -eq 1 ]]; then
+		local kind
+		if [[ ${UID} -eq 0 ]]; then
+			kind="system"
+		else
+			kind="user"
+		fi
+		set -- ${kind} ${@}
+	fi
+
 	if [[ ${#} != 2 ]]; then
 		die -q ${usage}
 	elif [[ ${1} == "system" ]]; then


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-24 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-24  9:21 [gentoo-commits] proj/eselect-java:java-vm-update commit in: /, src/modules/ Florian Schmaus
2022-06-24 10:33 ` [gentoo-commits] proj/eselect-java:master commit in: src/modules/, / Florian Schmaus
  -- strict thread matches above, loose matches on Subject: below --
2022-06-24  8:17 [gentoo-commits] proj/eselect-java:java-vm-update commit in: /, src/modules/ Florian Schmaus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox