56 lines
1.5 KiB
Bash
56 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# Helper script to sign Mylyn Gitea eclipse plugin
|
|
#
|
|
# Usage:
|
|
# 1. Configure the .sign.conf file
|
|
# 2. jarsign.sh [-x]
|
|
#
|
|
# Inspired from https://nirmalsasidharan.wordpress.com/2010/09/04/signing_eclipse_plugins/
|
|
#
|
|
|
|
# set debug
|
|
case "x$1" in "x-x" ) shift ; set -x ;; esac
|
|
|
|
#
|
|
# Sign all "not already signed" jar in a directory
|
|
# usage: jarsign_dir <directory>
|
|
#
|
|
jarsign_dir() {
|
|
for jarfile in ${1}/*.jar ; do
|
|
[ -e "$jarfile" ] || continue
|
|
unset result
|
|
case ${result:-$(jarsigner -verify -verbose ${opt_keystore} ${opt_storepass} ${opt_alias} ${jarfile} ${KEYALIAS} | egrep 'jar is unsigned|jar verified')} in
|
|
'jar is unsigned.' )
|
|
jarsigner ${opt_keystore} ${opt_storepass} -verbose ${opt_alias} ${jarfile} ${KEYALIAS} ;;
|
|
'jar verified.' )
|
|
echo "$jarfile already signed"
|
|
;;
|
|
* )
|
|
echo "***ERROR Raised by ${jarfile} signature verification..."
|
|
echo $result
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
WORKSPACEDIR=$(realpath "$(dirname $0)/.." )
|
|
SIGNPARAMS=${WORKSPACEDIR}/.sign.conf
|
|
if [ -x $SIGNPARAMS ] ; then
|
|
source $SIGNPARAMS
|
|
else
|
|
echo "Missing configuration file" && exit 1
|
|
fi
|
|
|
|
if (( $JARSIGN == 1)) ; then
|
|
[ -f "${KEYSTORE}" ] && opt_keystore="-keystore ${KEYSTORE}"
|
|
[ -n "${STOREPASS}" ] && opt_storepass="-storepass ${STOREPASS}"
|
|
|
|
jarsign_dir ${WORKSPACEDIR}/io.gitea.mylyn.updatesite
|
|
jarsign_dir ${WORKSPACEDIR}/io.gitea.mylyn.updatesite/features
|
|
jarsign_dir ${WORKSPACEDIR}/io.gitea.mylyn.updatesite/plugins
|
|
|
|
|
|
fi
|
|
|