#606 add delete blockchain

This commit is contained in:
Christian Rotzoll 2019-06-18 00:37:38 +02:00
parent 9e956b588d
commit b8a2472df0
3 changed files with 67 additions and 43 deletions

View File

@ -191,7 +191,8 @@ waitUntilChainNetworkIsReady()
fi
fi
if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options."
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options."
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
sleep 3
@ -206,48 +207,9 @@ To run a BACKUP of funds & channels first is recommended.
" 13 65
clear
# Basic Options
OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \
COPY "Copy from another Computer (SKILLED)" \
REINDEX "Resync thru ${network}d (TAKES VERY VERY LONG)" \
BACKUP "Run Backup LND data first (optional)"
)
CHOICE=$(dialog --backtitle "RaspiBlitz - Repair Script" --clear --title "Repair Blockchain Data" --menu "Choose a repair/recovery option:" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
clear
if [ "${CHOICE}" = "TORRENT" ]; then
echo "Starting TORRENT ..."
sudo sed -i "s/^state=.*/state=retorrent/g" /home/admin/raspiblitz.info
/home/admin/50torrentHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
/home/admin/00raspiblitz.sh
exit
elif [ "${CHOICE}" = "COPY" ]; then
echo "Starting COPY ..."
sudo sed -i "s/^state=.*/state=recopy/g" /home/admin/raspiblitz.info
/home/admin/50copyHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
/home/admin/00raspiblitz.sh
exit
elif [ "${CHOICE}" = "REINDEX" ]; then
echo "Starting REINDEX ..."
sudo /home/admin/config.scripts/network.reindex.sh
exit
elif [ "${CHOICE}" = "BACKUP" ]; then
sudo /home/admin/config.scripts/lnd.rescue.sh backup
echo "PRESS ENTER to return to menu."
read key
/home/admin/00raspiblitz.sh
exit
else
echo "CANCEL"
exit
fi
/home/admin/XXrepairBlockchain.sh
/home/admin/00raspiblitz.sh
exit
fi

View File

@ -22,6 +22,31 @@ if [ "${extraParameter}" = "-all" ]; then
echo "cleaning HDD ... (please wait)"
sudo rm -rfv /mnt/hdd/*
elif [ "${extraParameter}" = "-blockchain" ]; then
echo "!!!! This will DELETE JUST your blockchain from the HDD."
echo "--> It will keep your LND data and other setups."
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
echo "DELETING ..."
sudo rm -f -r /mnt/hdd/bitcoin 2>/dev/null
sudo rm -f -r /mnt/hdd/litecoin 2>/dev/null
echo "Starting Repair Options ..."
/home/admin/XXrepairBlockchain.sh
else
echo "!!!! This will DELETE your personal data & POSSIBLE FUNDS from the HDD !!!!"

View File

@ -0,0 +1,37 @@
#!/bin/bash
echo ""
# Basic Options
OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \
COPY "Copy from another Computer (SKILLED)" \
REINDEX "Resync thru ${network}d (TAKES VERY VERY LONG)" \
BACKUP "Run Backup LND data first (optional)"
)
CHOICE=$(dialog --backtitle "RaspiBlitz - Repair Script" --clear --title "Repair Blockchain Data" --menu "Choose a repair/recovery option:" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
clear
if [ "${CHOICE}" = "TORRENT" ]; then
echo "Starting TORRENT ..."
sudo sed -i "s/^state=.*/state=retorrent/g" /home/admin/raspiblitz.info
/home/admin/50torrentHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
elif [ "${CHOICE}" = "COPY" ]; then
echo "Starting COPY ..."
sudo sed -i "s/^state=.*/state=recopy/g" /home/admin/raspiblitz.info
/home/admin/50copyHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
elif [ "${CHOICE}" = "REINDEX" ]; then
echo "Starting REINDEX ..."
sudo /home/admin/config.scripts/network.reindex.sh
elif [ "${CHOICE}" = "BACKUP" ]; then
sudo /home/admin/config.scripts/lnd.rescue.sh backup
echo "PRESS ENTER to continue."
read key
else
echo "CANCEL"
fi