Merge #11997: [tests] util_tests.cpp: actually check ignored args
[bitcoinplatinum.git] / contrib / windeploy / detached-sig-create.sh
blobbf4978d1430149b4ed3572a484c01e6bb40f22c0
1 #!/bin/sh
2 # Copyright (c) 2014-2015 The Bitcoin Core developers
3 # Distributed under the MIT software license, see the accompanying
4 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 if [ -z "$OSSLSIGNCODE" ]; then
7 OSSLSIGNCODE=osslsigncode
8 fi
10 if [ ! -n "$1" ]; then
11 echo "usage: $0 <osslcodesign args>"
12 echo "example: $0 -key codesign.key"
13 exit 1
16 OUT=signature-win.tar.gz
17 SRCDIR=unsigned
18 WORKDIR=./.tmp
19 OUTDIR="${WORKDIR}/out"
20 OUTSUBDIR="${OUTDIR}/win"
21 TIMESERVER=http://timestamp.comodoca.com
22 CERTFILE="win-codesign.cert"
24 mkdir -p "${OUTSUBDIR}"
25 basename -a `ls -1 "${SRCDIR}"/*-unsigned.exe` | while read UNSIGNED; do
26 echo Signing "${UNSIGNED}"
27 "${OSSLSIGNCODE}" sign -certs "${CERTFILE}" -t "${TIMESERVER}" -in "${SRCDIR}/${UNSIGNED}" -out "${WORKDIR}/${UNSIGNED}" "$@"
28 "${OSSLSIGNCODE}" extract-signature -pem -in "${WORKDIR}/${UNSIGNED}" -out "${OUTSUBDIR}/${UNSIGNED}.pem" && rm "${WORKDIR}/${UNSIGNED}"
29 done
31 rm -f "${OUT}"
32 tar -C "${OUTDIR}" -czf "${OUT}" .
33 rm -rf "${WORKDIR}"
34 echo "Created ${OUT}"