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 9F2B1158094 for ; Fri, 24 Jun 2022 10:33:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A8E81E088C; Fri, 24 Jun 2022 10:33:39 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8BF80E088C for ; Fri, 24 Jun 2022 10:33:39 +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 871E6341A54 for ; Fri, 24 Jun 2022 10:33:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 25166512 for ; Fri, 24 Jun 2022 10:33:37 +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: <1656062460.a9fd19b87c15c4c573ab43b8547a26d6ea894ebc.flow@gentoo> Subject: [gentoo-commits] proj/eselect-java:master commit in: src/modules/, / X-VCS-Repository: proj/eselect-java X-VCS-Files: NEWS src/modules/java-vm.eselect.in X-VCS-Directories: / src/modules/ X-VCS-Committer: flow X-VCS-Committer-Name: Florian Schmaus X-VCS-Revision: a9fd19b87c15c4c573ab43b8547a26d6ea894ebc X-VCS-Branch: master Date: Fri, 24 Jun 2022 10:33:37 +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: 347e02c2-118e-484f-8194-f1b62d3ff1f4 X-Archives-Hash: 2a58de0307868d961393b5b38a85138c Message-ID: <20220624103337.2N8IonBq4amrTvzkgvoslycV4uGaa9Xf0RJnkYymTjc@z> commit: a9fd19b87c15c4c573ab43b8547a26d6ea894ebc Author: Florian Schmaus gentoo org> AuthorDate: Fri Jun 24 07:49:14 2022 +0000 Commit: Florian Schmaus gentoo 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 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 " + local usage="Usage [user|system] " 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