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

1.1       jmmv        1: #! @SH@
                      2: #
1.2     ! tv          3: # $NetBSD: java-wrapper.sh,v 1.1.1.1 2004/06/04 16:35:07 jmmv Exp $
1.1       jmmv        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)
1.2     ! tv         55: eval cmd=\"\$${varname}_CMD\"
1.1       jmmv       56: eval impl=\"\$${varname}\"
                     57: 
1.2     ! tv         58: if [ -z "${cmd}" -a -z "${impl}" -a -z "${DEFAULT}" ]; then
        !            59:        err "no mapping defined (${varname}_CMD, ${varname}, and DEFAULT are empty)."
1.1       jmmv       60: fi
                     61: 
1.2     ! tv         62: if [ -z "${cmd}" ]; then
        !            63:        cmd=${PREFIX}/bin/${impl:-${DEFAULT}}-${progname}
1.1       jmmv       64: 
1.2     ! tv         65:        if [ ! -f ${cmd} ]; then
        !            66:                err "cannot locate ${cmd} (incorrect mapping or missing package)."
        !            67:        fi
1.1       jmmv       68: fi
                     69: 
1.2     ! tv         70: exec ${cmd} "$@"

CVSweb <webmaster@jp.NetBSD.org>