diff options
author | glewis <glewis@FreeBSD.org> | 2004-12-08 04:18:04 +0800 |
---|---|---|
committer | glewis <glewis@FreeBSD.org> | 2004-12-08 04:18:04 +0800 |
commit | 0c3c45508819d01d67082e70f387b67412ff7098 (patch) | |
tree | b7b19c709359e5f230967b88dc9b086d2310cb58 /java | |
parent | ffc3219cf5eeec3db32738b71ae6489f6a85c1f6 (diff) | |
download | freebsd-ports-graphics-0c3c45508819d01d67082e70f387b67412ff7098.tar.gz freebsd-ports-graphics-0c3c45508819d01d67082e70f387b67412ff7098.tar.zst freebsd-ports-graphics-0c3c45508819d01d67082e70f387b67412ff7098.zip |
. Some minor comment and formatting fixes (should have probably have been
done separately).
. Much more stringent checks on VMs that we are trying to register. This
prevents most bogus and circular registrations. [1]
Suggested by: Josh Elsasser <josh@elsasser.org> [1]
Diffstat (limited to 'java')
-rw-r--r-- | java/javavmwrapper/src/javavmwrapper.sh | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/java/javavmwrapper/src/javavmwrapper.sh b/java/javavmwrapper/src/javavmwrapper.sh index b3685bd7e17..ac2ade91d5c 100644 --- a/java/javavmwrapper/src/javavmwrapper.sh +++ b/java/javavmwrapper/src/javavmwrapper.sh @@ -2,9 +2,9 @@ # # javawrapper.sh # -# Allows to install several Java Virtual Machines -# on the same system and use config file/or environment -# variable to select wichever to use +# Allow the installation of several Java Virtual Machines on the system. +# They can then be selected from based on environment variables and the +# configuration file. # # ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp): @@ -58,8 +58,8 @@ tryJavaCommand () { createJavaLinks () { for exe in "${1}"/bin/* "${1}"/jre/bin/*; do if [ -x "${exe}" -a \ - ! -d "${exe}" -a \ - "`basename "${exe}"`" = "`basename "${exe}" .so`" -a \ + ! -d "${exe}" -a \ + "`basename "${exe}"`" = "`basename "${exe}" .so`" -a \ ! -e "${PREFIX}/bin/`basename "${exe}"`" -a \ -w "${PREFIX}/bin" ]; then ln -s "${PREFIX}/bin/javavm" \ @@ -88,10 +88,22 @@ sortConfiguration () { export JAVAVMS while read JAVAVM; do VM=`echo "${JAVAVM}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null` - # Check the VM actually exists + # Check that the VM exists and is "sane" if [ ! -e "${VM}" ]; then continue fi + if [ -d "${VM}" ]; then + continue + fi + if [ ! -x "${VM}" ]; then + continue + fi + if [ `basename "${VM}"` != "java" ]; then + continue + fi + if [ "`realpath "${VM}" 2>/dev/null `" = "${PREFIX}/bin/javavm" ]; then + continue + fi # Skip duplicate VMs if [ ! -z "${JAVAVMS}" ]; then for _JAVAVM in ${JAVAVMS}; do @@ -266,15 +278,27 @@ registerVM () { exit 1 fi - # Check that the VM exists and is executable + # Check that the VM exists and is "sane" if [ ! -e "${VM}" ]; then echo "${IAM}: error: JavaVM \"${VM}\" does not exist" 1>&2 exit 1 fi + if [ -d "${VM}" ]; then + echo "${IAM}: error: JavaVM \"${VM}\" is a directory" 1>&2 + exit 1 + fi if [ ! -x "${VM}" ]; then echo "${IAM}: error: JavaVM \"${VM}\" is not executable" 1>&2 exit 1 fi + if [ `basename "${VM}"` != "java" ]; then + echo "${IAM}: error: JavaVM \"${VM}\" is not valid" 1>&2 + exit 1 + fi + if [ "`realpath "${VM}" 2>/dev/null `" = "${PREFIX}/bin/javavm" ]; then + echo "${IAM}: error: JavaVM \"${VM}\" is javavm!" 1>&2 + exit 1 + fi # Add the VM to the configuration file echo "${1}" >> "${CONF}" |