aboutsummaryrefslogtreecommitdiff
path: root/java/javavmwrapper
diff options
context:
space:
mode:
authorGreg Lewis <glewis@FreeBSD.org>2005-06-20 18:08:33 +0000
committerGreg Lewis <glewis@FreeBSD.org>2005-06-20 18:08:33 +0000
commitd9e60aea406a68510cabb419a0e17542b6ccb161 (patch)
tree04241c1a4e23f308fb795c9fdcec4a826844c807 /java/javavmwrapper
parent4d5beacc07354a67d152a2aa1ff2d50e969418bf (diff)
downloadports-d9e60aea406a68510cabb419a0e17542b6ccb161.tar.gz
ports-d9e60aea406a68510cabb419a0e17542b6ccb161.zip
. 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]
Notes
Notes: svn path=/head/; revision=137785
Diffstat (limited to 'java/javavmwrapper')
-rw-r--r--java/javavmwrapper/Makefile2
-rw-r--r--java/javavmwrapper/src/javavmwrapper.sh17
2 files changed, 11 insertions, 8 deletions
diff --git a/java/javavmwrapper/Makefile b/java/javavmwrapper/Makefile
index fa5cf828819d..86504088e945 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 0ec3334efaf0..7113b252600d 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}"`