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.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. set -e
  3. ROOTDIR=dist
  4. BUNDLE="${ROOTDIR}/Bitcoin-Qt.app"
  5. CODESIGN=codesign
  6. TEMPDIR=sign.temp
  7. TEMPLIST=${TEMPDIR}/signatures.txt
  8. OUT=signature.tar.gz
  9. OUTROOT=osx
  10. if [ ! -n "$1" ]; then
  11. echo "usage: $0 <codesign args>"
  12. echo "example: $0 -s MyIdentity"
  13. exit 1
  14. fi
  15. rm -rf ${TEMPDIR} ${TEMPLIST}
  16. mkdir -p ${TEMPDIR}
  17. ${CODESIGN} -f --file-list ${TEMPLIST} "$@" "${BUNDLE}"
  18. grep -v CodeResources < "${TEMPLIST}" | while read i; do
  19. TARGETFILE="${BUNDLE}/`echo "${i}" | sed "s|.*${BUNDLE}/||"`"
  20. SIZE=`pagestuff "$i" -p | tail -2 | grep size | sed 's/[^0-9]*//g'`
  21. OFFSET=`pagestuff "$i" -p | tail -2 | grep offset | sed 's/[^0-9]*//g'`
  22. SIGNFILE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}.sign"
  23. DIRNAME="`dirname "${SIGNFILE}"`"
  24. mkdir -p "${DIRNAME}"
  25. echo "Adding detached signature for: ${TARGETFILE}. Size: ${SIZE}. Offset: ${OFFSET}"
  26. dd if="$i" of="${SIGNFILE}" bs=1 skip=${OFFSET} count=${SIZE} 2>/dev/null
  27. done
  28. grep CodeResources < "${TEMPLIST}" | while read i; do
  29. TARGETFILE="${BUNDLE}/`echo "${i}" | sed "s|.*${BUNDLE}/||"`"
  30. RESOURCE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}"
  31. DIRNAME="`dirname "${RESOURCE}"`"
  32. mkdir -p "${DIRNAME}"
  33. echo "Adding resource for: "${TARGETFILE}""
  34. cp "${i}" "${RESOURCE}"
  35. done
  36. rm ${TEMPLIST}
  37. tar -C "${TEMPDIR}" -czf "${OUT}" .
  38. rm -rf "${TEMPDIR}"
  39. echo "Created ${OUT}"