ace34c1a63
- Make sure to destroy all symlinks pointing to ${PREFIX}/bin/javavm and ${PREFIX}/etc/javavms when we deinstall the package. Reviewed by: glewis (maintainer) Feature safe: yes
46 lines
1.2 KiB
Bash
46 lines
1.2 KiB
Bash
#!/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
|
|
|
|
# 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
|
|
|
|
# Destroy the symbolic links that were created for every executable for a VM.
|
|
find -L ${PKG_PREFIX}/bin -samefile ${PKG_PREFIX}/bin/javavm \
|
|
\! -name checkvms \! -name javavm \! -name manvm \
|
|
\! -name registervm \! -name unregistervm | xargs rm -f
|
|
|
|
# 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
|
|
|
|
# Remove the configuration file.
|
|
rm -f "${CONF}"
|
|
|
|
exit 0
|