Skip to content

Instantly share code, notes, and snippets.

@Sjors
Last active April 10, 2021 21:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sjors/ea4578dba596767c5e104ee4aaab09ce to your computer and use it in GitHub Desktop.
Save Sjors/ea4578dba596767c5e104ee4aaab09ce to your computer and use it in GitHub Desktop.
Fetches gitian assert files from VM and signs them on host machine
#!/bin/sh
SIGNED_BINARIES=0
while getopts ":n:v:s" opt; do
case $opt in
n)
NAME=$OPTARG
;;
v)
VERSION=$OPTARG
;;
s)
SIGNED_BINARIES=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
pushd gitian.sigs
git checkout master
git pull
if [ "$SIGNED_BINARIES" -eq "0" ]; then
mkdir -p $VERSION-osx-unsigned
mkdir -p $VERSION-win-unsigned
mkdir -p $VERSION-linux
scp -r gitian:gitian.sigs/$VERSION-osx-unsigned/$NAME $VERSION-osx-unsigned
scp -r gitian:gitian.sigs/$VERSION-win-unsigned/$NAME $VERSION-win-unsigned
scp -r gitian:gitian.sigs/$VERSION-linux/$NAME $VERSION-linux
else
mkdir -p $VERSION-osx-signed
mkdir -p $VERSION-win-signed
scp -r gitian:gitian.sigs/$VERSION-osx-signed/$NAME $VERSION-osx-signed
scp -r gitian:gitian.sigs/$VERSION-win-signed/$NAME $VERSION-win-signed
fi
if [ "$SIGNED_BINARIES" -eq "0" ]; then
# TODO: remove rc suffix from $VERSION and use:
gpg --output $VERSION-linux/$NAME/bitcoin-linux-0.16-build.assert.sig --detach-sig $VERSION-linux/$NAME/bitcoin-linux-0.16-build.assert
gpg --output $VERSION-osx-unsigned/$NAME/bitcoin-osx-0.16-build.assert.sig --detach-sig $VERSION-osx-unsigned/$NAME/bitcoin-osx-0.16-build.assert
gpg --output $VERSION-win-unsigned/$NAME/bitcoin-win-0.16-build.assert.sig --detach-sig $VERSION-win-unsigned/$NAME/bitcoin-win-0.16-build.assert
else
gpg --output $VERSION-osx-signed/$NAME/bitcoin-dmg-signer-build.assert.sig --detach-sig $VERSION-osx-signed/$NAME/bitcoin-dmg-signer-build.assert
gpg --output $VERSION-win-signed/$NAME/bitcoin-win-signer-build.assert.sig --detach-sig $VERSION-win-signed/$NAME/bitcoin-win-signer-build.assert
fi
if [ "$SIGNED_BINARIES" -eq "0" ]; then
git checkout -b $VERSION
git add $VERSION-linux/$NAME
git add $VERSION-osx-unsigned/$NAME
git add $VERSION-win-unsigned/$NAME
else
git checkout -b $VERSION-codesigned
git add $VERSION-osx-signed/$NAME
git add $VERSION-win-signed/$NAME
fi
if [ "$SIGNED_BINARIES" -eq "0" ]; then
git commit -S -a -m "Add $NAME $VERSION non-code signed signatures"
git push --set-upstream $NAME $VERSION
else
git commit -S -a -m "Add $NAME $VERSION code signed signatures"
git push --set-upstream $NAME $VERSION-codesigned
fi
pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment