You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

detached-sig-create.sh 1.0KB

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