mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-29 05:38:00 +00:00
. 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]
This commit is contained in:
parent
4d5beacc07
commit
d9e60aea40
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=137785
@ -9,7 +9,7 @@
|
||||
|
||||
PORTNAME= javavmwrapper
|
||||
PORTVERSION= 2.0
|
||||
PORTREVISION= 4
|
||||
PORTREVISION= 5
|
||||
CATEGORIES= java
|
||||
MASTER_SITES= # none
|
||||
DISTFILES= # none
|
||||
|
@ -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}"`
|
||||
|
Loading…
Reference in New Issue
Block a user