]> gerrit.simantics Code Review - simantics/platform.git/blob - releng/org.simantics.sdk.build.p2.site/sign.sh
55815198830ebae528f2c30c1175c414c4c25ce9
[simantics/platform.git] / releng / org.simantics.sdk.build.p2.site / sign.sh
1 #!/bin/bash
2
3 dir=`dirname $0`
4
5 if [ $# -lt 3 ]; then
6     echo "Usage: sign.sh <keystore location> <signing property file> <TSA URL>"
7     echo ""
8     echo "<signing property file> must contain the following properties:"
9     echo "    jarsigner.alias:     keystore entry alias"
10     echo "    jarsigner.storepass: password for the keystore"
11     echo ""
12     echo "<TSA URL> can be empty is timestamping is not desired."
13     exit -1
14 fi
15
16 keystore=$1
17 signprops=$2
18 tsa=$3
19
20 function signprop {
21     grep "${1}" "${signprops}"|cut -d'=' -f2
22 }
23
24 echo "----"
25 echo "script directory: ${dir}"
26 echo "keystore: ${keystore}"
27 echo "signing property file: ${signprops}"
28 echo "TSA URL: ${tsa}"
29
30 keyalias=$(signprop 'jarsigner.alias')
31 storepass=$(signprop 'jarsigner.storepass')
32
33 for jar in `find "${dir}/target/repository/plugins/" -type f -not -ipath '*.source_*.jar'`; do
34     echo "----"
35     if [ -z ${tsa} ]; then
36         echo "Signing $jar"
37         jarsigner -keystore "${keystore}" \
38                   -storepass ${storepass} \
39                   -verbose \
40                   "$jar" \
41                   ${keyalias}
42     else
43         echo "Signing and timestamping $jar"
44         jarsigner -keystore "${keystore}" \
45                   -storepass ${storepass} \
46                   -verbose \
47                   -tsa "${tsa}" \
48                   "$jar" \
49                   ${keyalias}
50     fi
51 done
52