---
name: javavmwrapper
version: 2.4_3
origin: java/javavmwrapper
comment: Wrapper script for various Java Virtual Machines
arch: freebsd:9:x86:64
www: UNKNOWN
maintainer: glewis@FreeBSD.org
prefix: /usr/local
licenselogic: single
flatsize: 35403
desc: |
  The Java VM wrapper provides a convenient system for switching between
  different Java VMs.  It also provides symbolic links in ${PREFIX}/bin to
  allow the use of the Java executables without having to add the specific
  Java VM executable directories to the PATH environment variable.
categories: [java]
files:
  /usr/local/bin/checkvms: '-'
  /usr/local/bin/classpath: 6f0962935c0860f72b939b96457e4b44f6bd796bb80129e76a5e7d0bb4916bf9
  /usr/local/bin/javavm: 21bd8e631813aacd6af5159e5c68eb80c5a1efcea92c8d19c43a3acc45ed343e
  /usr/local/bin/manvm: '-'
  /usr/local/bin/registervm: '-'
  /usr/local/bin/unregistervm: '-'
  /usr/local/etc/javavm_opts.conf.dist: 67f8e0b41dd6bbdc21beb504d90313ba7db3418ef0b960b61a8819efd84a8b09
  /usr/local/man/man1/checkvms.1.gz: 44c2dd1590cd315f0073b285bb69b54c14ec0f2099a5de1acae437870d070f6d
  /usr/local/man/man1/javavm.1.gz: 87fcbd9247479fba684a8b05ff63b4c421cdd5ecc36caf5fb0553026268c3c9b
  /usr/local/man/man1/manvm.1.gz: c251a2aedb3091426b81b561d533c09d5e06dc6c3e629db8e7c66a9ab1d30b98
  /usr/local/man/man1/registervm.1.gz: 5d874e408db13be9ffcd4dc3847c2c62b07a6196e40004da362c490293b3916c
  /usr/local/man/man1/unregistervm.1.gz: 5d874e408db13be9ffcd4dc3847c2c62b07a6196e40004da362c490293b3916c
  /usr/local/man/man5/javavm_opts.conf.5.gz: 536b9f90c539c2db6c3ddd1eb67ef2a4f5b60fdd63fb9d25440829d865832e10
  /usr/local/man/man5/javavms.5.gz: 91e0b4f40c9e3ae2c58ce793822136974e0b796dd33865a89eb92f2a78297343
scripts:
  install: |
    #!/bin/sh
    #
    # $FreeBSD: ports/java/javavmwrapper/files/pkg-install.in,v 1.5 2012/10/31 21:50:25 jkim Exp $

    LOCALBASE=/usr/local

    # This script runs during post-install
    if [ "x${2}" != "xPOST-INSTALL" ]; then
        exit 0
    fi

    # The option configuration file
    OPTION_CONF="${PKG_PREFIX}/etc/javavm_opts.conf"

    # Install default javavm options configuration
    if [ ! -e "${OPTION_CONF}" ]; then
        cp "${OPTION_CONF}.dist" "${OPTION_CONF}"
    else
        echo "${OPTION_CONF} already exists - not installing."
        echo "You may need to hand merge changes."
    fi

    # Ensure all JDKs and JREs are installed
    _excl_dirs='bootstrap-openjdk'
    _find_expr='-depth 2 -regex .*/bin/java'
    for dir in ${_excl_dirs}; do
        _find_expr="${_find_expr} ! -regex ${dir}/bin/java"
    done
    for jvm in `cd "${LOCALBASE}" && find *jdk* *jre* ${_find_expr} 2> /dev/null`; do
        if [ -x "${LOCALBASE}/${jvm}" ]; then
            "${PKG_PREFIX}"/bin/registervm "${LOCALBASE}/${jvm}" > /dev/null 2>&1
        fi
    done

    # Ensure all VMs are configured correctly
    "${PKG_PREFIX}"/bin/checkvms
  deinstall: "#!/bin/sh\n#\n# $FreeBSD: ports/java/javavmwrapper/pkg-deinstall,v 1.5
    2012/11/17 05:58:43 svnexp Exp $\n\nexport PATH=/bin:/sbin:/usr/bin:/usr/sbin\n\n#
    Run this script at the pre-deinstall stage\nif [ \"x${2}\" != \"xDEINSTALL\" ];
    then\n    exit 0\nfi\n\n# The option configuration file\nOPTION_CONF=\"${PKG_PREFIX}/etc/javavm_opts.conf\"\n\n#
    Remove the option configuration file if its identical to the\n# distributed version.\nif
    [ -f \"${OPTION_CONF}\" -a -f \"${OPTION_CONF}.dist\" ]; then\n\tif [ `sed -e
    '/^#/d' -e '/^\\s*$/d' \"${OPTION_CONF}\" | sort | md5` = \\\n\t     `sed -e '/^#/d'
    -e '/^\\s*$/d' \"${OPTION_CONF}.dist\" | sort | md5` ]; then\n\t\trm -f \"${OPTION_CONF}\"\n\tfi\nfi\n\n#
    Destroy the symbolic links that were created for every executable for a VM.\n_excl_links='checkvms
    manvm registervm unregistervm'\n_find_expr='-depth 1 -type l'\nfor i in ${_excl_links};
    do\n\t_find_expr=\"${_find_expr} ! -name ${i}\"\ndone\n_javavm_path=`realpath
    ${PKG_PREFIX}/bin/javavm`\nfor i in `find ${PKG_PREFIX}/bin ${_find_expr}`; do\n\tif
    [ \"${_javavm_path}\" = `realpath ${i}` ]; then\n\t\trm -f \"${i}\"\n\tfi\ndone\n\n#
    The configuration file\nCONF=\"${PKG_PREFIX}/etc/javavms\"\n\n# Ensure the configuration
    file exists\nif [ ! -f \"${CONF}\" ]; then\n    exit 0\nfi\n\n# Ensure the configuration
    file has the correct permissions\nif [ ! -r \"${CONF}\" ]; then\n    echo \"error:
    can't read configuration file ${CONF}\" 1>&2\n    exit 1\nfi\n\n# Remove the configuration
    file.\nrm -f \"${CONF}\"\n\nexit 0\n"
