aboutsummaryrefslogtreecommitdiff
path: root/contrib/gitian-descriptors/gitian-osx-signer.yml
blob: 214ca9823dd51951b6ec32338c28c2024f25aa8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
name: "bitcoin-dmg-signer"
distro: "ubuntu"
suites:
- "bionic"
architectures:
- "amd64"
packages:
- "faketime"
- "xorriso"
- "python3-pip"
remotes:
- "url": "https://github.com/bitcoin-core/bitcoin-detached-sigs.git"
  "dir": "signature"
- "url": "https://github.com/achow101/signapple.git"
  "dir": "signapple"
  "commit": "c7e73aa27a7615ac9506559173f787e2906b25eb"
files:
- "bitcoin-osx-unsigned.tar.gz"
script: |
  set -e -o pipefail

  WRAP_DIR=$HOME/wrapped
  mkdir -p ${WRAP_DIR}
  export PATH="$PWD":$PATH
  FAKETIME_PROGS="dmg xorrisofs"

  # Create global faketime wrappers
  for prog in ${FAKETIME_PROGS}; do
    echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
    echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
    echo "export LD_PRELOAD='/usr/\$LIB/faketime/libfaketime.so.1'" >> ${WRAP_DIR}/${prog}
    echo "export FAKETIME=\"${REFERENCE_DATETIME}\"" >> ${WRAP_DIR}/${prog}
    echo "\$REAL \$@" >> $WRAP_DIR/${prog}
    chmod +x ${WRAP_DIR}/${prog}
  done

  # Install signapple
  cd signapple
  python3 -m pip install -U pip setuptools
  python3 -m pip install .
  export PATH="$HOME/.local/bin":$PATH
  cd ..

  UNSIGNED_TARBALL=bitcoin-osx-unsigned.tar.gz
  UNSIGNED_APP=dist/Bitcoin-Qt.app
  SIGNED=bitcoin-osx-signed.dmg

  tar -xf ${UNSIGNED_TARBALL}
  OSX_VOLNAME="$(cat osx_volname)"
  ./detached-sig-apply.sh ${UNSIGNED_APP} signature/osx/dist
  ${WRAP_DIR}/xorrisofs -D -l -V "${OSX_VOLNAME}" -no-pad -r -dir-mode 0755 -o uncompressed.dmg signed-app
  ${WRAP_DIR}/dmg dmg uncompressed.dmg ${OUTDIR}/${SIGNED}