Browse Source

Activating RESYNC in RepairOptions

v1.3
Christian Rotzoll 6 years ago
parent
commit
ed008bb0bc
  1. 44
      home.admin/00raspiblitz.sh
  2. 1
      home.admin/10setupBlitz.sh
  3. 23
      home.admin/50syncHDD.sh
  4. 11
      home.admin/98repairBlockchain.sh
  5. 13
      home.admin/XXcleanHDD.sh

44
home.admin/00raspiblitz.sh

@ -171,10 +171,17 @@ waitUntilChainNetworkIsReady()
blockchainsize=$(sudo du -shbc /mnt/hdd/${network} 2>/dev/null | head -n1 | awk '{print $1;}') blockchainsize=$(sudo du -shbc /mnt/hdd/${network} 2>/dev/null | head -n1 | awk '{print $1;}')
if [ ${#blockchainsize} -gt 0 ]; then if [ ${#blockchainsize} -gt 0 ]; then
if [ ${blockchainsize} -lt ${minSize} ]; then if [ ${blockchainsize} -lt ${minSize} ]; then
echo "blockchainsize(${blockchainsize})" if [ "${state}" != "resync" ]; then
echo "Missing Blockchain Data (<${minSize}) ..." echo "blockchainsize(${blockchainsize})"
clienterror="missing blockchain" echo "Missing Blockchain Data (<${minSize}) ..."
sleep 3 clienterror="missing blockchain"
sleep 3
else
echo "RE-SYNC is running"
/home/admin/80scanLND.sh
sleep 10
exit 0;
fi
fi fi
fi fi
@ -196,20 +203,27 @@ waitUntilChainNetworkIsReady()
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
sleep 3 sleep 3
dialog --backtitle "RaspiBlitz - Repair Script" --msgbox "Your blockchain data needs to be repaired. whiptail --title "RaspiBlitz - Repair Script" --yes-button "DELETE+REPAIR" --no-button "Ignore" --yesno "Your blockchain data needs to be repaired.
This can be due to power problems or a failing HDD. This can be due to power problems or a failing HDD.
Please check the FAQ on RaspiBlitz Github For more info see: https://raspiblitz.com -> FAQ
'My blockchain data is corrupted - what can I do?'
https://github.com/rootzoll/raspiblitz/blob/master/FAQ.md
The RaspiBlitz will now try to help you on with the repair. Before RaspiBlitz can offer you repair options the old
To run a BACKUP of funds & channels first is recommended. corrupted blockchain needs to be deleted while your LND
" 13 65 funds and channel stay safe (just expect some off-time).
clear How do you want to continue?
/home/admin/98repairBlockchain.sh " 13 65
/home/admin/00raspiblitz.sh if [ $? -eq 0 ]; then
exit #delete+repair
clear
/home/admin/XXcleanHDD.sh -blockchain -force
/home/admin/98repairBlockchain.sh
/home/admin/00raspiblitz.sh
exit
else
# ignore - just delete blockchain logfile
clear
fi
fi fi

1
home.admin/10setupBlitz.sh

@ -220,6 +220,7 @@ if [ ${mountOK} -eq 1 ]; then
;; ;;
S) S)
/home/admin/50syncHDD.sh /home/admin/50syncHDD.sh
/home/admin/10setupBlitz.sh
;; ;;
esac esac
exit 1 exit 1

23
home.admin/50syncHDD.sh

@ -35,8 +35,8 @@ if [ "$network" = "bitcoin" ]; then
response=$? response=$?
case $response in case $response in
0) echo "--> OK";; 0) echo "--> OK";;
1) ./10setupBlitz.sh; exit 1;; 1) exit 1;;
255) ./10setupBlitz.sh; exit 1;; 255) exit 1;;
esac esac
clear clear
@ -57,11 +57,20 @@ if [ "$network" = "bitcoin" ]; then
fi fi
echo "*** Activating Blockain Sync ***" echo "*** Activating Blockain Sync ***"
sudo mkdir /mnt/hdd/${network} sudo mkdir /mnt/hdd/${network} 2>/dev/null
echo "OK - sync is activated" echo "OK - sync is activated"
# set SetupState if [ "${setupStep}" = "100" ]; then
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# continue setup # set so that 10raspiblitz.sh has a flag to see that resync is running
./60finishHDD.sh sudo sed -i "s/^state=.*/state=resync/g" $infoFile
else
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# continue setup
./60finishHDD.sh
fi

11
home.admin/98repairBlockchain.sh

@ -1,10 +1,14 @@
#!/bin/bash #!/bin/bash
echo "" echo ""
# load raspiblitz config data
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# Basic Options # Basic Options
OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \ OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \
COPY "Copy from another Computer (SKILLED)" \ COPY "Copy from another Computer (SKILLED)" \
REINDEX "Resync thru ${network}d (TAKES VERY VERY LONG)" \ RESYNC "Resync thru Peer2Peer Network (TRUSTLESS)" \
BACKUP "Run Backup LND data first (optional)" BACKUP "Run Backup LND data first (optional)"
) )
@ -23,6 +27,11 @@ elif [ "${CHOICE}" = "COPY" ]; then
/home/admin/50copyHDD.sh /home/admin/50copyHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
elif [ "${CHOICE}" = "RESYNC" ]; then
echo "Starting RESYNC ..."
/home/admin/50syncHDD.sh
/home/
elif [ "${CHOICE}" = "REINDEX" ]; then elif [ "${CHOICE}" = "REINDEX" ]; then
echo "Starting REINDEX ..." echo "Starting REINDEX ..."
sudo /home/admin/config.scripts/network.reindex.sh sudo /home/admin/config.scripts/network.reindex.sh

13
home.admin/XXcleanHDD.sh

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
echo "" echo ""
extraParameter="$1" extraParameter="$1"
forceParameter="$2"
if [ "${extraParameter}" = "-all" ]; then if [ "${extraParameter}" = "-all" ]; then
echo "!!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!" echo "!!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!"
@ -24,11 +25,13 @@ if [ "${extraParameter}" = "-all" ]; then
elif [ "${extraParameter}" = "-blockchain" ]; then elif [ "${extraParameter}" = "-blockchain" ]; then
echo "This will DELETE JUST your blockchain from the HDD." if [ "${forceParameter}" != "-force" ]; then
echo "--> It will keep your LND data and other setups." echo "This will DELETE JUST your blockchain from the HDD."
echo "--> You will get presented re-download options." echo "--> It will keep your LND data and other setups."
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)" echo "--> You will get presented re-download options."
read key echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
read key
fi
echo "stopping services ... (please wait)" echo "stopping services ... (please wait)"
echo "- swap" echo "- swap"

Loading…
Cancel
Save