build-monero/gitian/copy-sigs.sh

78 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# REWRITE IN PYTHON
# compare with: https://web.getmonero.org/downloads/hashes.txt
version=$1
archs="android freebsd linux osx win"
# first copy the assert files from the gitrun container on the build vm
# for arch in $archs; do
# docker cp gitrun:/home/ubuntu/${version}-${arch} sigs
# done
# can also copy the builds:
#
# docker cp gitrun:/home/ubuntu/out/$VERSION out
# and then run this script to copy them from the build vm to the host
# with gnupg
gh_username="benediktkr"
gitian_host="localhost"
gitian_port="5122"
gitian_user="gitian"
for arch in $archs; do
scp -rP ${gitian_port} ${gitian_user}@${gitian_host}:monero/contrib/gitian/sigs/${version}-${arch}/${gh_username}/ ${version}-${arch}/
done
echo
echo
# and then compare with someone else
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
compare_with="hyc"
echo "comparing my sigs with sigs from '${compare_with}':"
echo
matches="true"
for arch in $archs; do
my_hashes=$(cat ${version}-${arch}/${gh_username}/*.assert | yq '.[0] | .out_manifest' | sort)
compare_hashes=$(cat ${version}-${arch}/${compare_with}/*.assert | yq '.[0] | .out_manifest' | sort)
echo -n "${version}-${arch}: "
if [[ "$my_hashes" == "$compare_hashes" ]]; then
echo -e "${GREEN}OK${NC}"
else
echo -e "${RED}ERROR: HASHES DO NOT MATCH!!!!${NC}"
matches="false"
fi
done
echo
if [[ "${matches}" == "true" ]]; then
for arch in $archs; do
echo "signing assert file for: ${version}-${arch}"
gpg --detach-sign ${version}-${arch}/${gh_username}/*.assert
done
echo
echo
echo "git info"
echo "branch: ${version}"
echo "git commit -m \"Add ${gh_username} ${version}\""
exit 0
else
echo -e "${RED}some hashes did not match, exiting!${NC}"
exit 1
fi