. Usher in javavmwrapper 2.0, a rewrite of the wrapper scripts designed to
allow the simple use of multiple VMs. Brief detail of the main changes:
. When a VM is registered, symbolic links for its executables are
created in ${LOCALBASE}/bin. This allows people to just type
'java', 'javac', etc. without having to add the VM installation
directory to their PATH.
. The actual 'java' that is executed via one of these symlinks is
determined by the order of the (sorted) configuration file
${LOCALBASE}/etc/javavms and by the environment variables
JAVA_VERSION, JAVA_OS and JAVA_VENDOR which function to select
a VM as they do in the ports framework.
. There is a new command, checkvms, to sanity check the configuration
and symlinks.
. The "javavm" executable is currently retained in its original capacity
as a synonym for Java for backward compatibility. However, its use
is deprecated.
. Temporarily set MAINTAINER to myself to make monitoring any initial
bug reports easier. The intent is to convert it to java@ at a later
date.
This is built on the ideas of znerd, hq and Shelton C. Johnson Jr., with
hq and Shelton contributing code and reviews.
PR: 27079, 39080
Reviewed by: hq, Shelton C. Johnson Jr. <shelton_c_j@yahoo.com>
2004-11-11 20:17:37 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|
|
|
|
|
|
|
# Run this script at the pre-deinstall stage
|
|
|
|
if [ "x${2}" != "xDEINSTALL" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2006-06-03 19:32:24 +02:00
|
|
|
# The option configuration file
|
|
|
|
OPTION_CONF="${PKG_PREFIX}/etc/javavm_opts.conf"
|
|
|
|
|
|
|
|
# Remove the option configuration file if its identical to the
|
|
|
|
# distributed version.
|
|
|
|
if [ -f "${OPTION_CONF}" -a -f "${OPTION_CONF}.dist" ]; then
|
|
|
|
if [ `sed -e '/^#/d' -e '/^\s*$/d' "${OPTION_CONF}" | sort | md5` = \
|
|
|
|
`sed -e '/^#/d' -e '/^\s*$/d' "${OPTION_CONF}.dist" | sort | md5` ]; then
|
|
|
|
rm -f "${OPTION_CONF}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
. Usher in javavmwrapper 2.0, a rewrite of the wrapper scripts designed to
allow the simple use of multiple VMs. Brief detail of the main changes:
. When a VM is registered, symbolic links for its executables are
created in ${LOCALBASE}/bin. This allows people to just type
'java', 'javac', etc. without having to add the VM installation
directory to their PATH.
. The actual 'java' that is executed via one of these symlinks is
determined by the order of the (sorted) configuration file
${LOCALBASE}/etc/javavms and by the environment variables
JAVA_VERSION, JAVA_OS and JAVA_VENDOR which function to select
a VM as they do in the ports framework.
. There is a new command, checkvms, to sanity check the configuration
and symlinks.
. The "javavm" executable is currently retained in its original capacity
as a synonym for Java for backward compatibility. However, its use
is deprecated.
. Temporarily set MAINTAINER to myself to make monitoring any initial
bug reports easier. The intent is to convert it to java@ at a later
date.
This is built on the ideas of znerd, hq and Shelton C. Johnson Jr., with
hq and Shelton contributing code and reviews.
PR: 27079, 39080
Reviewed by: hq, Shelton C. Johnson Jr. <shelton_c_j@yahoo.com>
2004-11-11 20:17:37 +01:00
|
|
|
# The configuration file
|
|
|
|
CONF="${PKG_PREFIX}/etc/javavms"
|
|
|
|
|
|
|
|
# Ensure the configuration file exists
|
|
|
|
if [ ! -f "${CONF}" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Ensure the configuration file has the correct permissions
|
|
|
|
if [ ! -r "${CONF}" ]; then
|
|
|
|
echo "error: can't read configuration file ${CONF}" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Destroy the symbolic links that were created for every executable for a VM.
|
|
|
|
cat "${CONF}" | \
|
|
|
|
(
|
|
|
|
while read JAVAVM; do
|
|
|
|
VM=`echo "${JAVAVM}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
|
|
|
|
JAVA_HOME=`dirname "${VM}"`
|
|
|
|
JAVA_HOME=`dirname "${JAVA_HOME}"`
|
|
|
|
for exe in "${JAVA_HOME}"/bin/* "${JAVA_HOME}"/jre/bin/*; do
|
|
|
|
exe=`basename "${exe}"`
|
|
|
|
if [ -L "${PKG_PREFIX}/bin/${exe}" -a \
|
|
|
|
"`ls -ld "${PKG_PREFIX}/bin/${exe}" 2>/dev/null | \
|
|
|
|
awk '/->/{print $NF;exit 0}END{exit 1}'`" = \
|
|
|
|
"${PKG_PREFIX}/bin/javavm" ]; then
|
|
|
|
rm "${PKG_PREFIX}/bin/${exe}"
|
|
|
|
fi
|
|
|
|
done;
|
|
|
|
done;
|
|
|
|
)
|
|
|
|
|
|
|
|
exit 0
|