#!/bin/bash exec 1> >(logger -s -t mkbootstrap) 2>&1 if [[ ! -d /input/blocks ]]; then echo "unable to find blocksource" > /dev/stderr exit 1 fi set -x JSON="$(curl --user $RPCUSER:$RPCPASSWORD \ --max-time 20 \ --data-binary \ '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' \ -H 'content-type: text/plain;' \ http://$RPCHOST:8332/)" BLOCKS=$(jq -r .result.blocks <<< """$JSON""") HEADERS=$(jq -r .result.headers <<< """$JSON""") if [[ ! $BLOCKS -gt 405749 ]]; then echo "bitcoind does not have full chain yet" > /dev/stderr exit 1 fi if [[ ! $HEADERS -gt 405749 ]]; then echo "bitcoind does not have full chain yet" > /dev/stderr exit 1 fi if [[ $HEADERS -gt $BLOCKS ]]; then echo "bitcoind does not have full chain yet" > /dev/stderr exit 1 fi cd /usr/local/src/bitcoin/contrib/linearize C="/etc/linearize.conf" cat > $C <