Skip to content

Commit 95b06d2

Browse files
committed
gitian: use signapple to apply the MacOS code signature
1 parent 42bb1ea commit 95b06d2

File tree

2 files changed

+7
-36
lines changed

2 files changed

+7
-36
lines changed

contrib/gitian-descriptors/gitian-osx-signer.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ script: |
4242
export PATH="$HOME/.local/bin":$PATH
4343
cd ..
4444
45-
UNSIGNED=bitcoin-osx-unsigned.tar.gz
45+
UNSIGNED_TARBALL=bitcoin-osx-unsigned.tar.gz
46+
UNSIGNED_APP=dist/Bitcoin-Qt.app
4647
SIGNED=bitcoin-osx-signed.dmg
4748
48-
tar -xf ${UNSIGNED}
49+
tar -xf ${UNSIGNED_TARBALL}
4950
OSX_VOLNAME="$(cat osx_volname)"
50-
./detached-sig-apply.sh ${UNSIGNED} signature/osx
51+
./detached-sig-apply.sh ${UNSIGNED_APP} signature/osx/dist
5152
${WRAP_DIR}/xorrisofs -D -l -V "${OSX_VOLNAME}" -no-pad -r -dir-mode 0755 -o uncompressed.dmg signed-app
5253
${WRAP_DIR}/dmg dmg uncompressed.dmg ${OUTDIR}/${SIGNED}

contrib/macdeploy/detached-sig-apply.sh

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ set -e
88

99
UNSIGNED="$1"
1010
SIGNATURE="$2"
11-
ARCH=x86_64
1211
ROOTDIR=dist
13-
TEMPDIR=signed.temp
1412
OUTDIR=signed-app
13+
SIGNAPPLE=signapple
1514

1615
if [ -z "$UNSIGNED" ]; then
1716
echo "usage: $0 <unsigned app> <signature>"
@@ -23,35 +22,6 @@ if [ -z "$SIGNATURE" ]; then
2322
exit 1
2423
fi
2524

26-
rm -rf ${TEMPDIR} && mkdir -p ${TEMPDIR}
27-
tar -C ${TEMPDIR} -xf ${UNSIGNED}
28-
cp -rf "${SIGNATURE}"/* ${TEMPDIR}
29-
30-
if [ -z "${PAGESTUFF}" ]; then
31-
PAGESTUFF=${TEMPDIR}/pagestuff
32-
fi
33-
34-
if [ -z "${CODESIGN_ALLOCATE}" ]; then
35-
CODESIGN_ALLOCATE=${TEMPDIR}/codesign_allocate
36-
fi
37-
38-
find ${TEMPDIR} -name "*.sign" | while read i; do
39-
SIZE=$(stat -c %s "${i}")
40-
TARGET_FILE="$(echo "${i}" | sed 's/\.sign$//')"
41-
42-
echo "Allocating space for the signature of size ${SIZE} in ${TARGET_FILE}"
43-
${CODESIGN_ALLOCATE} -i "${TARGET_FILE}" -a ${ARCH} ${SIZE} -o "${i}.tmp"
44-
45-
OFFSET=$(${PAGESTUFF} "${i}.tmp" -p | tail -2 | grep offset | sed 's/[^0-9]*//g')
46-
if [ -z ${QUIET} ]; then
47-
echo "Attaching signature at offset ${OFFSET}"
48-
fi
49-
50-
dd if="$i" of="${i}.tmp" bs=1 seek=${OFFSET} count=${SIZE} 2>/dev/null
51-
mv "${i}.tmp" "${TARGET_FILE}"
52-
rm "${i}"
53-
echo "Success."
54-
done
55-
mv ${TEMPDIR}/${ROOTDIR} ${OUTDIR}
56-
rm -rf ${TEMPDIR}
25+
${SIGNAPPLE} apply ${UNSIGNED} ${SIGNATURE}
26+
mv ${ROOTDIR} ${OUTDIR}
5727
echo "Signed: ${OUTDIR}"

0 commit comments

Comments
 (0)