From e167f5955d2030bab14735eff9ba7b13d942c8e4 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Sat, 22 Feb 2020 21:49:44 +0200 Subject: [PATCH] Added jar signing support script gitlab simantics/platform#468 --- sign.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 sign.sh diff --git a/sign.sh b/sign.sh new file mode 100755 index 0000000..589a2ee --- /dev/null +++ b/sign.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +dir=`dirname $0` + +if [ $# -lt 3 ]; then + echo "Usage: sign.sh " + echo "" + echo " must contain the following properties:" + echo " jarsigner.alias: keystore entry alias" + echo " jarsigner.storepass: password for the keystore" + echo " jarsigner.keypass: password for the key " + echo "" + echo " can be empty is timestamping is not desired." + exit -1 +fi + +keystore=$1 +signprops=$2 +tsa=$3 + +function signprop { + grep "${1}" "${signprops}"|cut -d'=' -f2 +} + +echo "----" +echo "script directory: ${dir}" +echo "keystore: ${keystore}" +echo "signing property file: ${signprops}" +echo "TSA URL: ${tsa}" + +keyalias=$(signprop 'jarsigner.alias') +storepass=$(signprop 'jarsigner.storepass') +keypass=$(signprop 'jarsigner.keypass') + +for jar in `find "${dir}/p2/features/" "${dir}/p2/plugins/" -type f -not -ipath '*.source_*.jar'`; do + echo "----" + if [ -z ${tsa} ]; then + echo "Signing $jar" + jarsigner -keystore "${keystore}" \ + -storepass ${storepass} \ + -keypass ${keypass} \ + -verbose \ + "$jar" \ + ${keyalias} + else + echo "Signing and timestamping $jar" + jarsigner -keystore "${keystore}" \ + -storepass ${storepass} \ + -keypass ${keypass} \ + -verbose \ + -tsa "${tsa}" \ + "$jar" \ + ${keyalias} + fi +done + -- 2.47.1