FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bitcore-node/scripts/download at master · shadowproject/bitcore-node · GitHub
shadowproject
bitcore-node
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
bitcore-node
/
scripts
/
download
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
119 lines (99 loc) · 2.82 KB
Breadcrumbs
bitcore-node
/
scripts
/
download
Copy path
File metadata and controls
executable file
·
119 lines (99 loc) · 2.82 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!
/bin/bash
set
-e
root_dir=
"
$(
cd
"
$(
dirname
"
${BASH_SOURCE[0]}
"
)
"
&&
pwd
)
/..
"
platform=
`
uname -a
|
awk
'
{print tolower($1)}
'
`
arch=
`
uname -m
`
version=
"
0.12.1
"
url=
"
https://github.com/bitpay/bitcoin/releases/download
"
tag=
"
v0.12.1-bitcore-4
"
if
[
"
${platform}
"
==
"
linux
"
]
;
then
if
[
"
${arch}
"
==
"
x86_64
"
]
;
then
tarball_name=
"
bitcoin-
${version}
-linux64.tar.gz
"
elif
[
"
${arch}
"
==
"
x86_32
"
]
;
then
tarball_name=
"
bitcoin-
${version}
-linux32.tar.gz
"
fi
elif
[
"
${platform}
"
==
"
darwin
"
]
;
then
tarball_name=
"
bitcoin-
${version}
-osx64.tar.gz
"
else
echo
"
Bitcoin binary distribution not available for platform and architecture
"
exit
-1
fi
binary_url=
"
${url}
/
${tag}
/
${tarball_name}
"
shasums_url=
"
${url}
/
${tag}
/SHA256SUMS.asc
"
download_bitcoind
() {
cd
"
${root_dir}
/bin
"
echo
"
Downloading bitcoin:
${binary_url}
"
is_curl=true
if
hash
curl
2>
/dev/null
;
then
curl --fail -I
$binary_url
>
/dev/null
2>&1
else
is_curl=false
wget --server-response --spider
$binary_url
>
/dev/null
2>&1
fi
if
test
$?
-eq 0
;
then
if
[
"
${is_curl}
"
=
true
]
;
then
curl -L
$binary_url
>
$tarball_name
curl -L
$shasums_url
>
SHA256SUMS.asc
else
wget
$binary_url
wget
$shasums_url
fi
if
test
-e
"
${tarball_name}
"
;
then
echo
"
Unpacking bitcoin distribution
"
tar -xvzf
$tarball_name
if
test
$?
-eq 0
;
then
ln -sf
"
bitcoin-
${version}
/bin/bitcoind
"
return
;
fi
fi
fi
echo
"
Bitcoin binary distribution could not be downloaded
"
exit
-1
}
verify_download
() {
echo
"
Verifying signatures of bitcoin download
"
gpg --verify
"
${root_dir}
/bin/SHA256SUMS.asc
"
if
hash
shasum
2>
/dev/null
;
then
shasum_cmd=
"
shasum -a 256
"
else
shasum_cmd=
"
sha256sum
"
fi
download_sha=
$(
${shasum_cmd}
"
${root_dir}
/bin/
${tarball_name}
"
|
awk
'
{print $1}
'
)
expected_sha=
$(
cat
"
${root_dir}
/bin/SHA256SUMS.asc
"
|
grep
"
${tarball_name}
"
|
awk
'
{print $1}
'
)
echo
"
Checksum (download):
${download_sha}
"
echo
"
Checksum (verified):
${expected_sha}
"
if
[
"
${download_sha}
"
!=
"
${expected_sha}
"
]
;
then
echo
-e
"
\033[1;31mChecksums did NOT match!\033[0m\n
"
exit
1
else
echo
-e
"
\033[1;32mChecksums matched!\033[0m\n
"
fi
}
download=1
verify=0
if
[
"
${SKIP_BITCOIN_DOWNLOAD}
"
=
1 ]
;
then
download=0
;
fi
if
[
"
${VERIFY_BITCOIN_DOWNLOAD}
"
=
1 ]
;
then
verify=1
;
fi
while
[
-n
"
$1
"
]
;
do
param=
"
$1
"
value=
"
$2
"
case
$param
in
--skip-bitcoin-download)
download=0
;;
--verify-bitcoin-download)
verify=1
;;
esac
shift
done
if
[
"
${download}
"
=
1 ]
;
then
download_bitcoind
fi
if
[
"
${verify}
"
=
1 ]
;
then
verify_download
fi
exit
0
Back
|
FazBrowse Home
|
New Git URL