#!/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. _excl_links='checkvms manvm registervm unregistervm' _find_expr='-depth 1 -type l' for i in ${_excl_links}; do _find_expr="${_find_expr} ! -name ${i}" done _javavm_path=`realpath ${PKG_PREFIX}/bin/javavm` for i in `find ${PKG_PREFIX}/bin ${_find_expr}`; do if [ "${_javavm_path}" = `realpath ${i}` ]; then rm -f "${i}" fi done # 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