diff options
author | glewis <glewis@FreeBSD.org> | 2005-06-20 18:08:33 +0000 |
---|---|---|
committer | glewis <glewis@FreeBSD.org> | 2005-06-20 18:08:33 +0000 |
commit | 24760aafbc337663ba6612c5f59bd7866030695c (patch) | |
tree | 807f3ce45e6087b00017cbb2b83af91b62d0cdd3 /java | |
parent | 9d9122e6f1210ade18ca3414d231c9a008e9bb79 (diff) | |
download | FreeBSD-ports-24760aafbc337663ba6612c5f59bd7866030695c.zip FreeBSD-ports-24760aafbc337663ba6612c5f59bd7866030695c.tar.gz |
. Check the user can read/write the configuration file and that it exists
before attempting to sort it when running checkvms. This prevents a
double error message for an unprivileged user.
. When asked to register a VM that is already registered, don't error.
Print a warning that the VM is already registered and don't add it to
the configuration file (but do check its links and sort the config
file still). This prevents problems with
'make install -DFORCE_PKG_REGISTER'
erroring out during the post-install stage for the JDK ports.
Bump PORTREVISION for this change since it affects the various JDK
ports. [2]
Reported by: anholt, via hq [2]
Diffstat (limited to 'java')
-rw-r--r-- | java/javavmwrapper/Makefile | 2 | ||||
-rw-r--r-- | java/javavmwrapper/src/javavmwrapper.sh | 17 |
2 files changed, 11 insertions, 8 deletions
diff --git a/java/javavmwrapper/Makefile b/java/javavmwrapper/Makefile index fa5cf82..8650408 100644 --- a/java/javavmwrapper/Makefile +++ b/java/javavmwrapper/Makefile @@ -9,7 +9,7 @@ PORTNAME= javavmwrapper PORTVERSION= 2.0 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= java MASTER_SITES= # none DISTFILES= # none diff --git a/java/javavmwrapper/src/javavmwrapper.sh b/java/javavmwrapper/src/javavmwrapper.sh index 0ec3334..7113b25 100644 --- a/java/javavmwrapper/src/javavmwrapper.sh +++ b/java/javavmwrapper/src/javavmwrapper.sh @@ -226,10 +226,6 @@ sortConfiguration () { # Check all of the VMs in the configuration file # checkVMs () { - # Sort the configuration. This will also remove duplicates and - # non-existent VMs - sortConfiguration - # Ensure the configuration file exists if [ ! -f "${CONF}" ]; then exit 0 @@ -241,6 +237,10 @@ checkVMs () { exit 1 fi + # Sort the configuration. This will also remove duplicates and + # non-existent VMs + sortConfiguration + # Ensure links are created for every executable for a VM. cat "${CONF}" | \ ( @@ -273,9 +273,10 @@ registerVM () { # Check that the given VM can be found in the configuration file VM=`echo "${1}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null` + REGISTERED= if [ ! -z "`grep "${VM}" "${CONF}"`" ]; then - echo "${IAM}: error: JavaVM \"${VM}\" is already registered" 1>&2 - exit 1 + echo "${IAM}: warning: JavaVM \"${VM}\" is already registered" 1>&2 + REGISTERED="yes" fi # Check that the VM exists and is "sane" @@ -301,7 +302,9 @@ registerVM () { fi # Add the VM to the configuration file - echo "${1}" >> "${CONF}" + if [ "${REGISTERED}" != "yes" ]; then + echo "${1}" >> "${CONF}" + fi # Create symbolic links as appropriate if they don't exist. JAVA_HOME=`dirname "${VM}"` |