blob: c6b6af75ee067557f5724e7a3f5a690d368e7a51 [file] [log] [blame]
david_williams7d692f42009-03-02 00:59:06 +00001# echo
2# echo $(basename $1
david_williams438e2082009-06-07 05:59:09 +00003filename="${1}"
4jarname=$(basename "${filename}")
5
6export JAVA_HOME=/shared/common/ibm-java2-ppc-50
7#JAVA_HOME=/shared/common/ibm-java-ppc-604
8#JAVA_HOME=/shared/common/ibm-java-jdk-ppc-60
9
david_williams8ebda6d2010-08-03 17:45:35 +000010# if not provided by calling program, assume a simple place
david_williams438e2082009-06-07 05:59:09 +000011if [[ -z $VERIFYOUTDIR ]]
12then
david_williams8ebda6d2010-08-03 17:45:35 +000013 VERIFYOUTDIR="${HOME}"/temp/
14 mkdir -p $VERIFYOUTDIR
david_williams438e2082009-06-07 05:59:09 +000015fi
david_williams8ebda6d2010-08-03 17:45:35 +000016
17
david_williamsa01957e2010-08-01 20:32:22 +000018PPAT_PACKGZ="(.*).pack.gz$"
19if [[ "$jarname" =~ $PPAT_PACKGZ ]]
david_williams438e2082009-06-07 05:59:09 +000020then
21 basejarname=${BASH_REMATCH[1]}
22 #echo -e "\n basejarname: " $basejarname "\n"
23 $JAVA_HOME/jre/bin/unpack200 $filename /tmp/$basejarname
24 #unpack200 $filename /tmp/$basejarname
25 vresult=`$JAVA_HOME/bin/jarsigner -verify /tmp/$basejarname`
26 exitcode=$?
27 rm /tmp/$basejarname
28else
29 #echo -e "\n filename: " $filename "\n"
30 vresult=`$JAVA_HOME/bin/jarsigner -verify $filename`
31 exitcode=$?
32fi
33
david_williamsa01957e2010-08-01 20:32:22 +000034PPAT_VERIFIED="^jar\ verified.*"
35PPAT_UNSIGNED="^jar is unsigned.*"
36PPAT_NOMANIFEST="^no manifest.*"
37if [[ "${vresult}" =~ $PPAT_VERIFIED ]]
david_williams438e2082009-06-07 05:59:09 +000038then
39 printf '%-100s \t\t' " ${jarname}: " >> "${VERIFYOUTDIR}"/verified.txt
40 printf '%s\n' " ${vresult} " >> "${VERIFYOUTDIR}"/verified.txt
david_williamsa01957e2010-08-01 20:32:22 +000041elif [[ "${vresult}" =~ $PPAT_UNSIGNED ]]
david_williams438e2082009-06-07 05:59:09 +000042then
david_williams7d692f42009-03-02 00:59:06 +000043
44# purposely no line delimiter, so output of jarsigner is on same line
david_williams438e2082009-06-07 05:59:09 +000045 printf '%-100s \t\t' " ${jarname}: " >> "${VERIFYOUTDIR}"/unsigned.txt
46 printf '%s\n' " ${vresult} " >> "${VERIFYOUTDIR}"/unsigned.txt
david_williamsa01957e2010-08-01 20:32:22 +000047elif [[ "${vresult}" =~ PPAT_NOMANIFEST ]]
david_williams438e2082009-06-07 05:59:09 +000048then
david_williams7d692f42009-03-02 00:59:06 +000049
david_williams438e2082009-06-07 05:59:09 +000050# purposely no line delimiter, so output of jarsigner is on same line
51 printf '%-100s \t\t' " ${jarname}: " >> "${VERIFYOUTDIR}"/nomanifest.txt
52 printf '%s\n' " ${vresult} " >> "${VERIFYOUTDIR}"/nomanifest.txt
53
54else
55 printf '%-100s \t\t' " ${jarname}: " >> "${VERIFYOUTDIR}"/error.txt
56 printf '%s\n' " ${vresult} " >> "${VERIFYOUTDIR}"/error.txt
57fi
58
59if [[ $exitcode -gt 0 ]]
60then
61
62 echo -e "\n exitcode: " $exitcode: $(basename $filename)" \n" >> "${VERIFYOUTDIR}"/errorexit.txt
david_williams7d692f42009-03-02 00:59:06 +000063fi
64
65