22 changed files with 450 additions and 55 deletions
@ -0,0 +1,112 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
## get basic info |
||||
|
source /home/admin/raspiblitz.info 2>/dev/null |
||||
|
|
||||
|
# get local ip |
||||
|
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') |
||||
|
|
||||
|
# create bitcoin base directory and link with bitcoin user |
||||
|
sudo rm -rf /mnt/hdd/bitcoin 2>/dev/null |
||||
|
sudo mkdir /mnt/hdd/bitcoin |
||||
|
sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin |
||||
|
sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin |
||||
|
|
||||
|
clear |
||||
|
echo "************************************************************************************" |
||||
|
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from another computer" |
||||
|
echo "************************************************************************************" |
||||
|
echo "" |
||||
|
echo "You can use the blockchain from another bitcoin-core client with version greater or equal" |
||||
|
echo "to 0.17.1 with transaction index switched on (txindex=1 in the bitcoin.conf)." |
||||
|
echo "" |
||||
|
echo "Both computers (your RaspberryPi and the other computer with the full blockchain on) need" |
||||
|
echo "to be connected to the same local network." |
||||
|
echo "" |
||||
|
echo "Open a terminal on the source computer and change into the directory that constains the" |
||||
|
echo "blockchain data. You should see directories 'blocks', 'chainstate' & 'indexes'". |
||||
|
echo "Make sure the bitcoin client on that computer is stopped." |
||||
|
echo "" |
||||
|
echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:" |
||||
|
echo "sudo scp -r ./chainstate ./indexes ./testnet3 ./blocks bitcoin@${localip}:/home/bitcoin/.bitcoin" |
||||
|
echo "" |
||||
|
echo "This command will ask for your SSH PASSWORD A from this RaspiBlitz." |
||||
|
echo "It can take multiple hours until transfer is complete - be patient." |
||||
|
echo "************************************************************************************" |
||||
|
echo "PRESS ENTER if transfers is done OR if you want to choose another another option." |
||||
|
#echo "Copy, Paste and Execute the following commands - line by line:" |
||||
|
#echo "sudo scp -r ./chainstate bitcoin@${localip}:/home/bitcoin/.bitcoin/chainstate" |
||||
|
#echo "sudo scp -r ./indexes bitcoin@${localip}:/home/bitcoin/.bitcoin/indexes" |
||||
|
#echo "sudo scp -r ./blocks bitcoin@${localip}:/home/bitcoin/.bitcoin/blocks" |
||||
|
#echo "" |
||||
|
#echo "Every command above needs your SSH PASSWORD A to work and will take some time to transfer." |
||||
|
#echo "PRESS ENTER if all 3 transfers are done or if you dont care and you want to return to menu." |
||||
|
read key |
||||
|
|
||||
|
# unlink bitcoin user (will created later in setup again) |
||||
|
sudo unlink /home/bitcoin/.bitcoin |
||||
|
|
||||
|
# make quick check if data is there |
||||
|
anyDataAtAll=0 |
||||
|
quickCheckOK=1 |
||||
|
count=$(sudo ls /mnt/hdd/bitcoin/blocks 2>/dev/null | grep -c '.dat') |
||||
|
if [ ${count} -gt 0 ]; then |
||||
|
echo "Found data in /mnt/hdd/bitcoin/blocks" |
||||
|
anyDataAtAll=1 |
||||
|
fi |
||||
|
if [ ${count} -lt 3000 ]; then |
||||
|
echo "FAIL: transfere seems invalid - less then 3000 .dat files (${count})" |
||||
|
quickCheckOK=0 |
||||
|
fi |
||||
|
count=$(sudo ls /mnt/hdd/bitcoin/chainstate 2>/dev/null | grep -c '.ldb') |
||||
|
if [ ${count} -gt 0 ]; then |
||||
|
echo "Found data in /mnt/hdd/bitcoin/chainstate" |
||||
|
anyDataAtAll=1 |
||||
|
fi |
||||
|
if [ ${count} -lt 1400 ]; then |
||||
|
echo "FAIL: transfere seems invalid - less then 1400 .ldb files (${count})" |
||||
|
quickCheckOK=0 |
||||
|
fi |
||||
|
count=$(sudo ls /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | grep -c '.ldb') |
||||
|
if [ ${count} -gt 0 ]; then |
||||
|
echo "Found data in /mnt/hdd/bitcoin/indexes/txindex" |
||||
|
anyDataAtAll=1 |
||||
|
fi |
||||
|
if [ ${count} -lt 5200 ]; then |
||||
|
echo "FAIL: less then 5200 .ldb files (${count}) in /mnt/hdd/bitcoin/chainstate (transfere seems invalid)" |
||||
|
quickCheckOK=0 |
||||
|
fi |
||||
|
|
||||
|
# just if any data transferred .. |
||||
|
if [ ${anyDataAtAll} -eq 1 ]; then |
||||
|
|
||||
|
# data was invalkid - ask user to keep? |
||||
|
if [ ${quickCheckOK} -eq 0 ]; then |
||||
|
echo "*********************************************" |
||||
|
echo "There seems to be a invalid transfere." |
||||
|
echo "Wait 5 secs ..." |
||||
|
sleep 5 |
||||
|
dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 60 |
||||
|
response=$? |
||||
|
echo "response(${response})" |
||||
|
case $response in |
||||
|
1) quickCheckOK=1 ;; |
||||
|
esac |
||||
|
fi |
||||
|
|
||||
|
if [ ${quickCheckOK} -eq 0 ]; then |
||||
|
echo "Deleting invalid Data ..." |
||||
|
sudo rm -rf /mnt/hdd/bitcoin |
||||
|
sudo rm -rf /home/bitcoin/.bitcoin |
||||
|
sleep 2 |
||||
|
fi |
||||
|
|
||||
|
else |
||||
|
|
||||
|
# when no data transferred - just delete bitcoin base dir again |
||||
|
sudo rm -rf /mnt/hdd/bitcoin |
||||
|
|
||||
|
fi |
||||
|
|
||||
|
# setup script will decide the next logical step |
||||
|
./10setupBlitz.sh |
@ -1,30 +1,74 @@ |
|||||
|
#!/bin/bash |
||||
echo "" |
echo "" |
||||
echo "!!!! This will DELETE your data & POSSIBLE FUNDS from the HDD !!!!" |
extraParameter="$1" |
||||
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)" |
if [ "${extraParameter}" = "-all" ]; then |
||||
read key |
|
||||
sudo dphys-swapfile swapoff |
echo "!!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!" |
||||
sudo systemctl stop bitcoind.service 2>/dev/null |
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)" |
||||
sudo systemctl stop litecoind.service 2>/dev/null |
read key |
||||
sudo systemctl stop lnd.service 2>/dev/null |
|
||||
sudo rm -f -r /mnt/hdd/lnd |
echo "stopping services ... (please wait)" |
||||
sudo rm -f -r /mnt/hdd/ssh |
echo "- swap" |
||||
sudo rm -f /mnt/hdd/swapfile |
sudo dphys-swapfile swapoff |
||||
sudo rm -f /mnt/hdd/bitcoin/bitcoin.conf |
echo "- background" |
||||
sudo rm -f /mnt/hdd/bitcoin/bitcoin.pid |
sudo systemctl stop background 2>/dev/null |
||||
sudo rm -f /mnt/hdd/bitcoin/*.dat |
echo "- lnd" |
||||
sudo rm -f /mnt/hdd/bitcoin/*.log |
sudo systemctl stop lnd.service 2>/dev/null |
||||
sudo rm -f /mnt/hdd/bitcoin/*.pid |
echo "- blockchain" |
||||
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.dat |
sudo systemctl stop bitcoind.service 2>/dev/null |
||||
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.log |
sudo systemctl stop litecoind.service 2>/dev/null |
||||
sudo rm -f /mnt/hdd/bitcoin/testnet3/.lock |
|
||||
sudo rm -f /mnt/hdd/litecoin/litecoin.conf |
# delete plain all on HDD |
||||
sudo rm -f /mnt/hdd/litecoin/litecoin.pid |
echo "cleaning HDD ... (please wait)" |
||||
sudo rm -f /mnt/hdd/litecoin/*.dat |
sudo rm -rfv /mnt/hdd/* |
||||
sudo rm -f /mnt/hdd/litecoin/*.log |
|
||||
sudo rm -f /mnt/hdd/litecoin/*.pid |
else |
||||
sudo rm -f -r /mnt/hdd/lost+found |
|
||||
sudo rm -f -r /mnt/hdd/download |
echo "!!!! This will DELETE your personal data & POSSIBLE FUNDS from the HDD !!!!" |
||||
sudo rm -f -r /mnt/hdd/tor |
echo "--> It will keep Blockchain data - so you dont have to download/copy again." |
||||
sudo rm -f /mnt/hdd/raspiblitz.conf |
echo "--> If you want to delete also blockchain data, please run with '-all' parameter." |
||||
sudo rm -f /home/admin/raspiblitz.info |
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)" |
||||
|
read key |
||||
|
|
||||
|
echo "stopping services ... (please wait)" |
||||
|
echo "- swap" |
||||
|
sudo dphys-swapfile swapoff |
||||
|
echo "- background" |
||||
|
sudo systemctl stop background 2>/dev/null |
||||
|
echo "- lnd" |
||||
|
sudo systemctl stop lnd.service 2>/dev/null |
||||
|
echo "- blockchain" |
||||
|
sudo systemctl stop bitcoind.service 2>/dev/null |
||||
|
sudo systemctl stop litecoind.service 2>/dev/null |
||||
|
|
||||
|
# just delete selective |
||||
|
echo "selective delete ... (please wait)" |
||||
|
sudo rm -f -r /mnt/hdd/lnd |
||||
|
sudo rm -f -r /mnt/hdd/ssh |
||||
|
sudo rm -f /mnt/hdd/swapfile |
||||
|
sudo rm -f /mnt/hdd/bitcoin/bitcoin.conf |
||||
|
sudo rm -f /mnt/hdd/bitcoin/bitcoin.pid |
||||
|
sudo rm -f /mnt/hdd/bitcoin/*.dat |
||||
|
sudo rm -f /mnt/hdd/bitcoin/*.log |
||||
|
sudo rm -f /mnt/hdd/bitcoin/*.pid |
||||
|
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.dat |
||||
|
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.log |
||||
|
sudo rm -f /mnt/hdd/bitcoin/testnet3/.lock |
||||
|
sudo rm -f /mnt/hdd/litecoin/litecoin.conf |
||||
|
sudo rm -f /mnt/hdd/litecoin/litecoin.pid |
||||
|
sudo rm -f /mnt/hdd/litecoin/*.dat |
||||
|
sudo rm -f /mnt/hdd/litecoin/*.log |
||||
|
sudo rm -f /mnt/hdd/litecoin/*.pid |
||||
|
sudo rm -f -r /mnt/hdd/lost+found |
||||
|
sudo rm -f -r /mnt/hdd/download |
||||
|
sudo rm -f -r /mnt/hdd/tor |
||||
|
sudo rm -f /mnt/hdd/raspiblitz.conf |
||||
|
sudo rm -f /home/admin/raspiblitz.info |
||||
|
|
||||
|
fi |
||||
|
|
||||
|
echo "*************************" |
||||
echo "OK - the HDD is now clean" |
echo "OK - the HDD is now clean" |
||||
|
echo "*************************" |
||||
|
echo "reboot -> sudo shutdown -r now" |
||||
|
echo "power off -> sudo shutdown now" |
||||
|
@ -0,0 +1,52 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
|
||||
|
<rss version="2.0"> |
||||
|
|
||||
|
<channel> |
||||
|
|
||||
|
<title>RaspiBlitz TorrentSeeds RSS</title> |
||||
|
<description>Help on seeding the lastest RaspiBlitz Torrent Seeds</description> |
||||
|
<language>en-en</language> |
||||
|
|
||||
|
<!-- Upload new versions to wiki.fulmo.org --> |
||||
|
<link>http://wiki.fulmo.org/downloads/raspiblitz-torrents-rss.xml</link> |
||||
|
|
||||
|
<item> |
||||
|
<guid>http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-bitcoin1-2018-10-13-base.torrent</guid> |
||||
|
<title>raspiblitz-bitcoin1-2018-10-13-base.torrent</title> |
||||
|
<enclosure |
||||
|
url="http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-bitcoin1-2018-10-13-base.torrent" |
||||
|
type="application/x-bittorrent" |
||||
|
/> |
||||
|
</item> |
||||
|
|
||||
|
<item> |
||||
|
<guid>http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-bitcoin1-2019-01-16-update.torrent</guid> |
||||
|
<title>raspiblitz-bitcoin1-2019-01-16-update.torrent</title> |
||||
|
<enclosure |
||||
|
url="http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-bitcoin1-2019-01-16-update.torrent" |
||||
|
type="application/x-bittorrent" |
||||
|
/> |
||||
|
</item> |
||||
|
|
||||
|
<item> |
||||
|
<guid>http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-litecoin1-2018-11-18-base.torrent</guid> |
||||
|
<title>raspiblitz-litecoin1-2018-11-18-base.torrent</title> |
||||
|
<enclosure |
||||
|
url="http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-litecoin1-2018-11-18-base.torrent" |
||||
|
type="application/x-bittorrent" |
||||
|
/> |
||||
|
</item> |
||||
|
|
||||
|
<item> |
||||
|
<guid>http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-litecoin1-2018-11-18-update.torrent</guid> |
||||
|
<title>raspiblitz-litecoin1-2018-11-18-update.torrent</title> |
||||
|
<enclosure |
||||
|
url="http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-litecoin1-2018-11-18-update.torrent" |
||||
|
type="application/x-bittorrent" |
||||
|
/> |
||||
|
</item> |
||||
|
|
||||
|
</channel> |
||||
|
|
||||
|
</rss> |
@ -0,0 +1,87 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
# command info |
||||
|
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then |
||||
|
echo "script to run re-index if the blockchain (in case of repair)" |
||||
|
echo "run to start or monitor re-index progress" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# check and load raspiblitz config |
||||
|
# to know which network is running |
||||
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null |
||||
|
if [ ${#network} -eq 0 ]; then |
||||
|
echo "FAIL - missing /mnt/hdd/raspiblitz.conf" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# load raspiblitz.info to know if reindex is already running |
||||
|
source /home/admin/raspiblitz.info 2>/dev/null |
||||
|
if [ ${#state} -eq 0 ]; then |
||||
|
echo "FAIL - missing /home/admin/raspiblitz.info" |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
# if re-index is not running, start ... |
||||
|
if [ "${state}" != "reindex" ]; then |
||||
|
|
||||
|
# stop services |
||||
|
echo "making sure services are not running .." |
||||
|
sudo systemctl stop lnd 2>/dev/null |
||||
|
sudo systemctl stop ${network}d 2>/dev/null |
||||
|
|
||||
|
# starting reindex |
||||
|
echo "starting re-index ..." |
||||
|
sudo -u bitcoin /usr/local/bin/${network}d -daemon -reindex -conf=/home/bitcoin/.${network}/${network}.conf -datadir=/home/bitcoin/.${network} |
||||
|
|
||||
|
# set reindex flag in raspiblitz.info (gets deleted after (final) reboot) |
||||
|
sudo sed -i "s/^state=.*/state=reindex/g" /home/admin/raspiblitz.info |
||||
|
|
||||
|
fi |
||||
|
|
||||
|
# while loop to wait to finish |
||||
|
finished=0 |
||||
|
while [ ${finished} -eq 0 ] |
||||
|
do |
||||
|
clear |
||||
|
echo "*************************" |
||||
|
echo "REINDEXING BLOCKCHAIN" |
||||
|
echo "*************************" |
||||
|
date |
||||
|
echo "THIS CAN TAKE SOME LONG TIME" |
||||
|
echo "If you dont see any progress after 24h keep X pressed to stop." |
||||
|
|
||||
|
progress=0 |
||||
|
echo "" |
||||
|
echo "PROGRESS: ${progress}%" |
||||
|
echo "" |
||||
|
|
||||
|
#TODO: detect and display progress |
||||
|
#TODO: determine when finished and then finished=1 |
||||
|
|
||||
|
echo "You can close terminal while reindex is running.." |
||||
|
echo "But you have to login again to check if ready." |
||||
|
|
||||
|
# wait 2 seconds for key input |
||||
|
read -n 1 -t 2 keyPressed |
||||
|
|
||||
|
# check if user wants to abort monitor |
||||
|
if [ "${keyPressed}" = "x" ]; then |
||||
|
echo "stopped by user ..." |
||||
|
break |
||||
|
fi |
||||
|
|
||||
|
done |
||||
|
|
||||
|
# trigger reboot when finished |
||||
|
echo "*************************" |
||||
|
echo "Re-Index finished" |
||||
|
echo "Starting reboot ..." |
||||
|
echo "*************************" |
||||
|
# stop bitcoind |
||||
|
sudo -u bitcoin ${network}-cli stop |
||||
|
sleep 4 |
||||
|
# clean logs (to prevent a false reindex detection) |
||||
|
sudo rm /mnt/hdd/${network}/debug.log |
||||
|
# reboot |
||||
|
sudo shutdown -r now |
Loading…
Reference in new issue