3
3
# Distributed under the MIT software license, see the accompanying
4
4
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
5
6
- # ## This script attempts to download the signature file SHA256SUMS.asc from bitcoin.org
6
+ # ## This script attempts to download the signature file SHA256SUMS.asc from
7
+ # ## bitcoincore.org and bitcoin.org and compares them.
7
8
# ## It first checks if the signature passes, and then downloads the files specified in
8
9
# ## the file, and checks if the hashes of these files match those that are specified
9
10
# ## in the signature file.
@@ -22,7 +23,9 @@ TMPFILE="hashes.tmp"
22
23
23
24
SIGNATUREFILENAME=" SHA256SUMS.asc"
24
25
RCSUBDIR=" test"
25
- BASEDIR=" https://bitcoin.org/bin/"
26
+ HOST1=" https://bitcoincore.org"
27
+ HOST2=" https://bitcoin.org"
28
+ BASEDIR=" /bin/"
26
29
VERSIONPREFIX=" bitcoin-core-"
27
30
RCVERSIONSTRING=" rc"
28
31
81
84
fi
82
85
83
86
# first we fetch the file containing the signature
84
- WGETOUT=$( wget -N " $BASEDIR$SIGNATUREFILENAME " 2>&1 )
87
+ WGETOUT=$( wget -N " $HOST1$ BASEDIR$SIGNATUREFILENAME " 2>&1 )
85
88
86
89
# and then see if wget completed successfully
87
90
if [ $? -ne 0 ]; then
@@ -92,6 +95,22 @@ if [ $? -ne 0 ]; then
92
95
exit 2
93
96
fi
94
97
98
+ WGETOUT=$( wget -N -O " $SIGNATUREFILENAME .2" " $HOST2$BASEDIR$SIGNATUREFILENAME " 2>&1 )
99
+ if [ $? -ne 0 ]; then
100
+ echo " bitcoin.org failed to provide signature file, but bitcoincore.org did?"
101
+ echo " wget output:"
102
+ echo " $WGETOUT " | sed ' s/^/\t/g'
103
+ clean_up $SIGNATUREFILENAME
104
+ exit 3
105
+ fi
106
+
107
+ SIGFILEDIFFS=" $( diff $SIGNATUREFILENAME $SIGNATUREFILENAME .2) "
108
+ if [ " $SIGFILEDIFFS " != " " ]; then
109
+ echo " bitcoin.org and bitcoincore.org signature files were not equal?"
110
+ clean_up $SIGNATUREFILENAME $SIGNATUREFILENAME .2
111
+ exit 4
112
+ fi
113
+
95
114
# then we check it
96
115
GPGOUT=$( gpg --yes --decrypt --output " $TMPFILE " " $SIGNATUREFILENAME " 2>&1 )
97
116
@@ -111,7 +130,7 @@ if [ $RET -ne 0 ]; then
111
130
112
131
echo " gpg output:"
113
132
echo " $GPGOUT " | sed ' s/^/\t/g'
114
- clean_up $SIGNATUREFILENAME $TMPFILE
133
+ clean_up $SIGNATUREFILENAME $SIGNATUREFILENAME .2 $ TMPFILE
115
134
exit " $RET "
116
135
fi
117
136
@@ -131,7 +150,7 @@ FILES=$(awk '{print $2}' "$TMPFILE")
131
150
for file in $FILES
132
151
do
133
152
echo " Downloading $file "
134
- wget --quiet -N " $BASEDIR$file "
153
+ wget --quiet -N " $HOST1$ BASEDIR$file "
135
154
done
136
155
137
156
# check hashes
149
168
150
169
if [ -n " $2 " ]; then
151
170
echo " Clean up the binaries"
152
- clean_up $FILES $SIGNATUREFILENAME $TMPFILE
171
+ clean_up $FILES $SIGNATUREFILENAME $SIGNATUREFILENAME .2 $ TMPFILE
153
172
else
154
173
echo " Keep the binaries in $WORKINGDIR "
155
174
clean_up $TMPFILE
0 commit comments