From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CB089158094 for ; Fri, 24 Jun 2022 07:57:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 26CCFE0843; Fri, 24 Jun 2022 07:57:34 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0E9C7E0843 for ; Fri, 24 Jun 2022 07:57:34 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3C6733419A9 for ; Fri, 24 Jun 2022 07:57:33 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CBA683C3 for ; Fri, 24 Jun 2022 07:57:31 +0000 (UTC) From: "Florian Schmaus" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Florian Schmaus" Message-ID: <1656057449.a4a40a8b84cbcc58320c66dbcf046a986d6af530.flow@gentoo> Subject: [gentoo-commits] proj/eselect-java:java-vm-update commit in: src/modules/ X-VCS-Repository: proj/eselect-java X-VCS-Files: src/modules/java-vm.eselect.in X-VCS-Directories: src/modules/ X-VCS-Committer: flow X-VCS-Committer-Name: Florian Schmaus X-VCS-Revision: a4a40a8b84cbcc58320c66dbcf046a986d6af530 X-VCS-Branch: java-vm-update Date: Fri, 24 Jun 2022 07:57:31 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: dedbea3e-d8f4-453c-baad-a6f79a3029a2 X-Archives-Hash: e0f73adef450c90f07b5949fc6dbe036 commit: a4a40a8b84cbcc58320c66dbcf046a986d6af530 Author: Florian Schmaus gentoo org> AuthorDate: Fri Jun 24 07:49:14 2022 +0000 Commit: Florian Schmaus gentoo org> CommitDate: Fri Jun 24 07:57:29 2022 +0000 URL: https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=a4a40a8b Decide based on the UID if system or user VM should be modified Signed-off-by: Florian Schmaus gentoo.org> src/modules/java-vm.eselect.in | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 " + local usage="Usage [user|system] " 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