Annotation of pkgsrc/lang/java-wrapper/files/java-wrapper.sh, revision 1.1

1.1     ! jmmv        1: #! @SH@
        !             2: #
        !             3: # $NetBSD$
        !             4: #
        !             5: # java-wrapper - Runs different Java implementations transparently.
        !             6: # Copyright (c) 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
        !             7: #
        !             8: # Redistribution and use in source and binary forms, with or without
        !             9: # modification, are permitted provided that the following conditions
        !            10: # are met:
        !            11: # 1. Redistributions of source code must retain the above copyright
        !            12: #    notice, this list of conditions and the following disclaimer.
        !            13: # 2. Redistributions in binary form must reproduce the above copyright
        !            14: #    notice, this list of conditions and the following disclaimer in
        !            15: #    the documentation and/or other materials provided with the
        !            16: #    distribution.
        !            17: # 3. Neither the name of author nor the names of its contributors may
        !            18: #    be used to endorse or promote products derived from this software
        !            19: #    without specific prior written permission.
        !            20: #
        !            21: # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
        !            22: # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
        !            23: # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        !            24: # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
        !            25: # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        !            26: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        !            27: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        !            28: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        !            29: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        !            30: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        !            31: # POSSIBILITY OF SUCH DAMAGE.
        !            32: #
        !            33: 
        !            34: PREFIX="@PREFIX@"
        !            35: PKG_SYSCONFDIR="@PKG_SYSCONFDIR@"
        !            36: TR="@TR@"
        !            37: 
        !            38: progname=${0##*/}
        !            39: 
        !            40: err() {
        !            41:        echo "${progname}: $*" 1>&2
        !            42:        echo "${progname}: See java-wrapper(1) for more information." 1>&2
        !            43:        exit 1
        !            44: }
        !            45: 
        !            46: if [ -f ${HOME}/.java-wrapper.conf ]; then
        !            47:        . ${HOME}/.java-wrapper.conf
        !            48: elif [ -f ${PKG_SYSCONFDIR}/java-wrapper.conf ]; then
        !            49:        . ${PKG_SYSCONFDIR}/java-wrapper.conf
        !            50: else
        !            51:        err "cannot open configuration file."
        !            52: fi
        !            53: 
        !            54: varname=$(echo ${progname} | ${TR} a-z A-Z)
        !            55: eval impl=\"\$${varname}\"
        !            56: 
        !            57: if [ -z "${impl}" -a -z "${DEFAULT}" ]; then
        !            58:        err "no mapping defined (${varname} and DEFAULT are empty)."
        !            59: fi
        !            60: 
        !            61: bin=${PREFIX}/bin/${impl:-${DEFAULT}}-${progname}
        !            62: 
        !            63: if [ ! -f ${bin} ]; then
        !            64:        err "cannot locate ${bin} (incorrect mapping or missing package)."
        !            65: fi
        !            66: 
        !            67: ${bin} "$@"

CVSweb <webmaster@jp.NetBSD.org>