diff options
author | Florian Schmaus <flow@gentoo.org> | 2022-06-24 09:49:14 +0200 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2022-06-24 11:21:00 +0200 |
commit | a9fd19b87c15c4c573ab43b8547a26d6ea894ebc (patch) | |
tree | 64dcb4984d18c9c52329c47cbaf4dc0f9e7f02ec | |
parent | Add "eselect java-vm update" (diff) | |
download | eselect-java-a9fd19b87c15c4c573ab43b8547a26d6ea894ebc.tar.gz eselect-java-a9fd19b87c15c4c573ab43b8547a26d6ea894ebc.tar.bz2 eselect-java-a9fd19b87c15c4c573ab43b8547a26d6ea894ebc.zip |
Decide based on the UID if system or user VM should be modifiedjava-vm-update
Signed-off-by: Florian Schmaus <flow@gentoo.org>
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/modules/java-vm.eselect.in | 14 |
2 files changed, 14 insertions, 1 deletions
@@ -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 |