1#!/bin/sh
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4#
5# Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
6#
7# The contents of this file are subject to the terms of either the GNU
8# General Public License Version 2 only ("GPL") or the Common Development
9# and Distribution License("CDDL") (collectively, the "License").  You
10# may not use this file except in compliance with the License.  You can
11# obtain a copy of the License at
12# https://oss.oracle.com/licenses/CDDL+GPL-1.1
13# or LICENSE.txt.  See the License for the specific
14# language governing permissions and limitations under the License.
15#
16# When distributing the software, include this License Header Notice in each
17# file and include the License file at LICENSE.txt.
18#
19# GPL Classpath Exception:
20# Oracle designates this particular file as subject to the "Classpath"
21# exception as provided by Oracle in the GPL Version 2 section of the License
22# file that accompanied this code.
23#
24# Modifications:
25# If applicable, add the following below the License Header, with the fields
26# enclosed by brackets [] replaced by your own identifying information:
27# "Portions Copyright [year] [name of copyright owner]"
28#
29# Contributor(s):
30# If you wish your version of this file to be governed by only the CDDL or
31# only the GPL Version 2, indicate your decision by adding "[Contributor]
32# elects to include this software in this distribution under the [CDDL or GPL
33# Version 2] license."  If you don't indicate a single choice of license, a
34# recipient has the option to distribute your version of this file under
35# either the CDDL, the GPL Version 2 or to extend the choice of license to
36# its licensees as provided above.  However, if you add GPL Version 2 code
37# and therefore, elected the GPL Version 2 license, then the option applies
38# only if the new code is made subject to such option by the copyright
39# holder.
40#
41
42#
43# Generate a new signature file.
44#
45# Usage: siggen javax.mail.jar mail.sig
46#
47SIGTEST=${SIGTEST:-/java/re/sigtest/4.0/promoted/fcs/latest/binaries/sigtest-4.0}
48SIGTEST_JAR=$SIGTEST/lib/sigtestdev.jar
49JAVA_HOME=${JAVA_HOME:-/opt/jdk1.8}
50PKG=javax.mail
51USAGE="siggen [-p package] javax.mail.jar mail.sig"
52
53while getopts p: opt
54do
55	case $opt in
56	p)	PKG="$OPTARG";;
57	\?)	echo $USAGE; exit 1;;
58	esac
59done
60shift `expr $OPTIND - 1`
61
62ver=$($JAVA_HOME/bin/java -version 2>&1 | sed -e 's/.*"\(.*\)".*/\1/;q')
63case "$ver" in
641.[0-9]*)	xjimage=;
65		cp="$1:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/jre/lib/jce.jar";;
66*)		xjimage="-xjimage ${JAVA_HOME}/bin/jimage";
67		cp="$1:${JAVA_HOME}/lib/modules";;
68esac
69
70${JAVA_HOME}/bin/java -jar $SIGTEST_JAR setup -static \
71	-classpath "$cp" $xjimage \
72	-filename "$2" -package "$PKG" -nonclosedfile
73