Skip to content

Commit 44691f3

Browse files
committed
Merge #8557: [contrib] Rework verifybinaries
faaed88 [contrib] verifybinaries: Mention mandatory preparation step (MarcoFalke) fa917f6 [contrib] verifybinaries: Keep downloads by default (MarcoFalke) fab1f92 [contrib] verifybinaries: Adjust parsing to new rc path (MarcoFalke)
2 parents 0e563d8 + faaed88 commit 44691f3

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

contrib/verifybinaries/README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
### Verify Binaries
2+
3+
#### Preparation:
4+
5+
Make sure you obtain the proper release signing key and verify the fingerprint with several independent sources.
6+
7+
```sh
8+
$ gpg --fingerprint "Bitcoin Core binary release signing key"
9+
pub 4096R/36C2E964 2015-06-24 [expires: 2017-02-13]
10+
Key fingerprint = 01EA 5486 DE18 A882 D4C2 6845 90C8 019E 36C2 E964
11+
uid Wladimir J. van der Laan (Bitcoin Core binary release signing key) <[email protected]>
12+
```
13+
14+
#### Usage:
15+
216
This script attempts to download the signature file `SHA256SUMS.asc` from https://bitcoin.org.
317

418
It first checks if the signature passes, and then downloads the files specified in the file, and checks if the hashes of these files match those that are specified in the signature file.
519

620
The script returns 0 if everything passes the checks. It returns 1 if either the signature check or the hash check doesn't pass. If an error occurs the return value is 2.
721

8-
Usage:
922

1023
```sh
1124
./verify.sh bitcoin-core-0.11.2
1225
./verify.sh bitcoin-core-0.12.0
26+
./verify.sh bitcoin-core-0.13.0-rc3
27+
```
28+
29+
If you do not want to keep the downloaded binaries, specify anything as the second parameter.
30+
31+
```sh
32+
./verify.sh bitcoin-core-0.13.0 delete
1333
```

contrib/verifybinaries/verify.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ function clean_up {
1414
done
1515
}
1616

17-
WORKINGDIR="/tmp/bitcoin"
17+
WORKINGDIR="/tmp/bitcoin_verify_binaries"
1818
TMPFILE="hashes.tmp"
1919

2020
SIGNATUREFILENAME="SHA256SUMS.asc"
21-
RCSUBDIR="test/"
21+
RCSUBDIR="test"
2222
BASEDIR="https://bitcoin.org/bin/"
2323
VERSIONPREFIX="bitcoin-core-"
2424
RCVERSIONSTRING="rc"
@@ -43,7 +43,7 @@ if [ -n "$1" ]; then
4343
# and simultaneously add RCSUBDIR to BASEDIR, where we will look for SIGNATUREFILENAME
4444
if [[ $VERSION == *"$RCVERSIONSTRING"* ]]; then
4545
BASEDIR="$BASEDIR${VERSION/%-$RCVERSIONSTRING*}/"
46-
BASEDIR="$BASEDIR$RCSUBDIR"
46+
BASEDIR="$BASEDIR$RCSUBDIR.$RCVERSIONSTRING${VERSION: -1}/"
4747
else
4848
BASEDIR="$BASEDIR$VERSION/"
4949
fi
@@ -93,7 +93,7 @@ fi
9393
FILES=$(awk '{print $2}' "$TMPFILE")
9494

9595
#and download these one by one
96-
for file in in $FILES
96+
for file in $FILES
9797
do
9898
wget --quiet -N "$BASEDIR$file"
9999
done
@@ -108,11 +108,16 @@ if [ $? -eq 1 ]; then
108108
exit 1
109109
elif [ $? -gt 1 ]; then
110110
echo "Error executing 'diff'"
111-
exit 2
111+
exit 2
112112
fi
113113

114-
#everything matches! clean up the mess
115-
clean_up $FILES $SIGNATUREFILENAME $TMPFILE
114+
if [ -n "$2" ]; then
115+
echo "Clean up the binaries"
116+
clean_up $FILES $SIGNATUREFILENAME $TMPFILE
117+
else
118+
echo "Keep the binaries in $WORKINGDIR"
119+
clean_up $TMPFILE
120+
fi
116121

117122
echo -e "Verified hashes of \n$FILES"
118123

0 commit comments

Comments
 (0)