2019-06-18 19:38:01 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
installDir=$1
|
|
|
|
if [[ -z $installDir ]]; then
|
|
|
|
installDir="$(cd "$(dirname "$0")"/..; pwd)"
|
|
|
|
fi
|
|
|
|
|
2019-06-19 10:30:44 -07:00
|
|
|
channel=$(
|
|
|
|
cd "$(dirname "$0")";
|
|
|
|
node -p '
|
|
|
|
let p = [
|
2020-01-06 15:47:19 -08:00
|
|
|
"../../package.json",
|
2019-06-19 10:30:44 -07:00
|
|
|
"../lib/node_modules/@solana/web3.js/package.json",
|
|
|
|
"../@solana/web3.js/package.json",
|
|
|
|
"../package.json"
|
|
|
|
].find(require("fs").existsSync);
|
2020-01-06 15:47:19 -08:00
|
|
|
if (!p) throw new Error("Unable to locate package.json");
|
2019-06-19 10:30:44 -07:00
|
|
|
require(p)["testnetDefaultChannel"]
|
|
|
|
'
|
|
|
|
)
|
|
|
|
|
2019-06-18 19:38:01 -07:00
|
|
|
if [[ -n $2 ]]; then
|
|
|
|
channel=$2
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Installing $channel BPF SDK into $installDir"
|
|
|
|
|
|
|
|
set -x
|
|
|
|
cd "$installDir/"
|
|
|
|
curl -L --retry 5 --retry-delay 2 -o bpf-sdk.tar.bz2 \
|
|
|
|
http://solana-sdk.s3.amazonaws.com/"$channel"/bpf-sdk.tar.bz2
|
|
|
|
rm -rf bpf-sdk
|
|
|
|
mkdir -p bpf-sdk
|
|
|
|
tar jxf bpf-sdk.tar.bz2
|
|
|
|
rm -f bpf-sdk.tar.bz2
|
|
|
|
|
|
|
|
cat bpf-sdk/version.txt
|