prepare.sh (848B)
1 #!/bin/bash 2 3 ## Install required dependencies to run tests without sudo 4 5 set -eu 6 7 DIR=$(mktemp -d) 8 9 function cleanup() { 10 for n in `jobs -p`; do 11 kill $n 2> /dev/null || true 12 done 13 rm -rf $DIR 2> /dev/null 14 wait 15 } 16 17 trap cleanup EXIT 18 19 BTC_VER="29.0" 20 21 CALLER_DIR="$PWD" 22 cd $DIR 23 24 rm -rfv $CALLER_DIR/tools 25 mkdir -pv $CALLER_DIR/tools 26 27 echo "Ⅰ - Find installed postgres version" 28 PG_VER=`pg_config --version | egrep -o '[0-9]{1,}' | head -1` 29 echo "Found version $PG_VER" 30 31 echo "Ⅱ - Install bitcoind version $BTC_VER" 32 ARCH=`uname -m` 33 curl -L https://bitcoincore.org/bin/bitcoin-core-$BTC_VER/bitcoin-$BTC_VER-$ARCH-linux-gnu.tar.gz -o btc.tar.gz 34 tar xvzf btc.tar.gz 35 mv -v bitcoin-$BTC_VER/bin/* $CALLER_DIR/tools 36 37 echo "Ⅴ - PATH" 38 39 echo "Add PATH=\"$CALLER_DIR/tools:/usr/lib/postgresql/$PG_VER/bin:\$PATH\" to your bash profile"