build: start of install script
This commit is contained in:
parent
7c6e5cf7b1
commit
c116353b8d
|
@ -3,7 +3,6 @@
|
|||
"description": "Full node with extended capabilities using Bitcore and Bitcoin Core",
|
||||
"author": "BitPay <dev@bitpay.com>",
|
||||
"version": "2.1.1-dev",
|
||||
"lastBuild": "2.1.1",
|
||||
"main": "./index.js",
|
||||
"repository": "git://github.com/bitpay/bitcore-node.git",
|
||||
"homepage": "https://github.com/bitpay/bitcore-node",
|
||||
|
@ -31,6 +30,7 @@
|
|||
"bitcore-node": "./bin/bitcore-node"
|
||||
},
|
||||
"scripts": {
|
||||
"install": "./scripts/install",
|
||||
"test": "NODE_ENV=test mocha -R spec --recursive",
|
||||
"coverage": "NODE_ENV=test istanbul cover _mocha -- --recursive"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||
platform=`uname -a | awk '{print tolower($1)}'`
|
||||
arch=`uname -m`
|
||||
version="0.12.0-bitcore"
|
||||
url="https://github.com/"
|
||||
|
||||
cd "${root_dir}/bin"
|
||||
|
||||
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}/${tarball_name}"
|
||||
|
||||
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 $binary_url > $tarball_name
|
||||
else
|
||||
wget $binary_url
|
||||
fi
|
||||
if test -e "${tarball_name}"; then
|
||||
echo "Unpacking bitcoin distribution"
|
||||
tar -xvzf $tarball_name
|
||||
if test $? -eq 0; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "Bitcoin binary distribution could not be downloaded"
|
||||
exit -1
|
Loading…
Reference in New Issue