2019-06-19 00:06:05 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# get raspiblitz config
|
|
|
|
source /home/admin/raspiblitz.info
|
|
|
|
source /mnt/hdd/raspiblitz.conf
|
|
|
|
|
2019-06-27 22:20:31 +02:00
|
|
|
askBackupCopy()
|
|
|
|
{
|
2021-12-20 21:37:58 +01:00
|
|
|
whiptail --title "Lightning Data Backup" --yes-button "Backup" --no-button "Skip" --yesno "
|
2019-06-27 22:20:31 +02:00
|
|
|
Before deleting your data, do you want
|
2021-12-20 21:37:58 +01:00
|
|
|
to make a backup of all your Lightning Data
|
|
|
|
and download the file(s) to your laptop?
|
2019-06-19 00:06:05 +02:00
|
|
|
|
2021-12-20 21:37:58 +01:00
|
|
|
Download Lightning Data Backup now?
|
2019-06-27 22:20:31 +02:00
|
|
|
" 12 44
|
2019-06-19 00:55:16 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
2021-12-20 21:37:58 +01:00
|
|
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" = "on" ]; then
|
|
|
|
clear
|
|
|
|
echo "***********************************"
|
|
|
|
echo "* PREPARING THE LND BACKUP DOWNLOAD"
|
|
|
|
echo "***********************************"
|
|
|
|
echo "please wait .."
|
|
|
|
/home/admin/config.scripts/lnd.compact.sh interactive
|
|
|
|
/home/admin/config.scripts/lnd.backup.sh lnd-export-gui
|
|
|
|
echo
|
|
|
|
echo "PRESS ENTER to continue once you're done downloading."
|
|
|
|
read key
|
|
|
|
fi
|
|
|
|
if [ "${lightning}" == "cl" ] || [ "${cl}" = "on" ]; then
|
|
|
|
clear
|
2022-07-27 08:29:16 +02:00
|
|
|
echo "**********************************************"
|
|
|
|
echo "* PREPARING THE CORE LIGHTNING BACKUP DOWNLOAD"
|
|
|
|
echo "**********************************************"
|
2021-12-20 21:37:58 +01:00
|
|
|
echo "please wait .."
|
|
|
|
/home/admin/config.scripts/cl.backup.sh cl-export-gui
|
|
|
|
echo
|
|
|
|
echo "PRESS ENTER to continue once you're done downloading."
|
|
|
|
read key
|
|
|
|
fi
|
2019-06-19 00:55:16 +02:00
|
|
|
else
|
|
|
|
clear
|
2022-01-04 20:08:38 +01:00
|
|
|
echo "*************************************"
|
|
|
|
echo "* JUST MAKING A BACKUP TO THE SD CARD"
|
|
|
|
echo "*************************************"
|
2019-06-19 00:55:16 +02:00
|
|
|
echo "please wait .."
|
|
|
|
sleep 2
|
2021-12-20 21:37:58 +01:00
|
|
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" = "on" ]; then
|
|
|
|
/home/admin/config.scripts/lnd.backup.sh lnd-export
|
|
|
|
fi
|
|
|
|
if [ "${lightning}" == "cl" ] || [ "${cl}" = "on" ]; then
|
|
|
|
/home/admin/config.scripts/cl.backup.sh cl-export
|
|
|
|
fi
|
|
|
|
sleep 3
|
2019-06-19 00:55:16 +02:00
|
|
|
fi
|
2019-06-27 22:20:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
infoResetSDCard()
|
|
|
|
{
|
|
|
|
whiptail --title "RESET DONE" --msgbox "
|
|
|
|
OK Reset of HDD is done.
|
|
|
|
System will now shutdown.
|
|
|
|
|
|
|
|
To start fresh please write a fresh
|
|
|
|
RaspiBlitz image to your SD card.
|
|
|
|
" 12 40
|
|
|
|
}
|
|
|
|
|
2023-01-25 19:07:13 +01:00
|
|
|
# get status of txindex
|
|
|
|
source <(/home/admin/config.scripts/network.txindex.sh status)
|
|
|
|
|
2021-08-30 21:14:58 +02:00
|
|
|
OPTIONS=()
|
|
|
|
#OPTIONS+=(HARDWARE "Run Hardwaretest")
|
|
|
|
OPTIONS+=(SOFTWARE "Run Softwaretest (DebugReport)")
|
|
|
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
2022-01-04 20:08:38 +01:00
|
|
|
OPTIONS+=(REPAIR-LND "Repair/Backup LND")
|
2021-08-30 21:14:58 +02:00
|
|
|
fi
|
2021-09-26 11:30:09 +02:00
|
|
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
2022-07-27 08:29:16 +02:00
|
|
|
OPTIONS+=(REPAIR-CL "Repair/Backup Core Lightning")
|
2021-09-06 21:45:16 +02:00
|
|
|
fi
|
2021-08-30 21:14:58 +02:00
|
|
|
OPTIONS+=(MIGRATION "Migrate Blitz Data to new Hardware")
|
|
|
|
OPTIONS+=(COPY-SOURCE "Copy Blockchain Source Modus")
|
2023-01-25 19:07:13 +01:00
|
|
|
if [ "${txindex}" == "1" ]; then
|
|
|
|
OPTIONS+=(DELETE-INDEX "Reindex Bitcoin Transaction-Index")
|
|
|
|
elif [ "${indexByteSize}" != "0" ]; then
|
|
|
|
OPTIONS+=(DELETE-INDEX "Delete Bitcoin Transaction-Index")
|
|
|
|
fi
|
|
|
|
OPTIONS+=(REINDEX-UTXO "Redindex Just Bitcoin Chainstate (Fast)")
|
|
|
|
OPTIONS+=(REINDEX-FULL "Redindex Full Bitcoin Blockchain (Slow)")
|
2021-08-30 21:14:58 +02:00
|
|
|
OPTIONS+=(RESET-CHAIN "Delete Blockchain & Re-Download")
|
|
|
|
OPTIONS+=(RESET-HDD "Delete HDD Data but keep Blockchain")
|
|
|
|
OPTIONS+=(RESET-ALL "Delete HDD completely to start fresh")
|
2021-08-30 21:15:59 +02:00
|
|
|
OPTIONS+=(DELETE-ELEC "Delete Electrum Index")
|
2019-06-19 00:55:16 +02:00
|
|
|
|
2021-12-07 12:13:03 +01:00
|
|
|
CHOICE=$(whiptail --clear --title "Repair Options" --menu "" 19 62 12 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
2019-06-27 22:20:31 +02:00
|
|
|
|
|
|
|
clear
|
|
|
|
case $CHOICE in
|
2021-04-17 21:52:26 +02:00
|
|
|
# HARDWARE)
|
|
|
|
# ;;
|
2019-06-27 22:20:31 +02:00
|
|
|
SOFTWARE)
|
2023-01-15 21:51:08 +01:00
|
|
|
echo "Generating debug logs. Be patient, this should take maximum 2 minutes .."
|
|
|
|
sudo rm /var/cache/raspiblitz/debug.log 2>/dev/null
|
|
|
|
/home/admin/config.scripts/blitz.debug.sh > /var/cache/raspiblitz/debug.log
|
|
|
|
echo "Redacting .."
|
|
|
|
/home/admin/config.scripts/blitz.debug.sh redact /var/cache/raspiblitz/debug.log
|
|
|
|
sudo chmod 640 /var/cache/raspiblitz/debug.log
|
|
|
|
sudo chown root:sudo /var/cache/raspiblitz/debug.log
|
|
|
|
cat /var/cache/raspiblitz/debug.log
|
|
|
|
echo
|
2019-06-27 22:20:31 +02:00
|
|
|
echo "Press ENTER to return to main menu."
|
|
|
|
read key
|
|
|
|
;;
|
2022-01-04 20:08:38 +01:00
|
|
|
REPAIR-LND)
|
2022-01-17 12:40:26 +01:00
|
|
|
/home/admin/99lndRepairMenu.sh
|
2021-12-07 12:13:03 +01:00
|
|
|
echo
|
|
|
|
echo "Press ENTER to return to main menu."
|
|
|
|
read key
|
|
|
|
;;
|
2021-09-26 11:30:09 +02:00
|
|
|
REPAIR-CL)
|
2022-01-17 12:40:26 +01:00
|
|
|
/home/admin/99clRepairMenu.sh
|
2021-09-06 21:45:16 +02:00
|
|
|
echo
|
|
|
|
echo "Press ENTER to return to main menu."
|
|
|
|
read key
|
|
|
|
;;
|
2020-02-14 15:04:04 +01:00
|
|
|
MIGRATION)
|
2022-02-09 12:48:25 +01:00
|
|
|
if [ "${cl}" == "on" ] || [ "${cl}" == "1" ] && [ "${clEncryptedHSM}" != "on" ] ; then
|
|
|
|
dialog \
|
2022-07-27 08:37:36 +02:00
|
|
|
--title "Encrypt the Core Lightning wallet" \
|
|
|
|
--msgbox "\nWill proceed to encrypt and lock the Core Lightning wallet to prevent it from starting automatically after the backup" 9 55
|
2022-02-09 12:48:25 +01:00
|
|
|
sudo /home/admin/config.scripts/cl.hsmtool.sh encrypt mainnet
|
|
|
|
fi
|
2022-02-13 00:46:38 +01:00
|
|
|
if [ "${clAutoUnlock}" = "on" ]; then
|
|
|
|
/home/admin/config.scripts/cl.hsmtool.sh autounlock-off mainnet
|
|
|
|
fi
|
|
|
|
/home/admin/config.scripts/cl.hsmtool.sh lock mainnet
|
2020-02-14 14:35:11 +01:00
|
|
|
sudo /home/admin/config.scripts/blitz.migration.sh "export-gui"
|
2020-02-14 13:12:57 +01:00
|
|
|
echo "Press ENTER to return to main menu."
|
|
|
|
read key
|
|
|
|
;;
|
2019-06-27 22:20:31 +02:00
|
|
|
RESET-CHAIN)
|
|
|
|
/home/admin/XXcleanHDD.sh -blockchain
|
|
|
|
/home/admin/98repairBlockchain.sh
|
|
|
|
echo "For reboot type: sudo shutdown -r now"
|
|
|
|
exit 1;
|
|
|
|
;;
|
|
|
|
RESET-HDD)
|
|
|
|
askBackupCopy
|
2019-06-19 00:55:16 +02:00
|
|
|
/home/admin/XXcleanHDD.sh
|
2019-06-27 22:20:31 +02:00
|
|
|
infoResetSDCard
|
|
|
|
sudo shutdown now
|
|
|
|
exit 1;
|
|
|
|
;;
|
|
|
|
RESET-ALL)
|
|
|
|
askBackupCopy
|
|
|
|
/home/admin/XXcleanHDD.sh -all
|
|
|
|
infoResetSDCard
|
|
|
|
sudo shutdown now
|
2019-06-19 00:06:05 +02:00
|
|
|
exit 1;
|
|
|
|
;;
|
2020-05-01 21:40:25 +02:00
|
|
|
DELETE-ELEC)
|
2020-05-02 21:33:39 +02:00
|
|
|
/home/admin/config.scripts/bonus.electrs.sh off deleteindex
|
2021-08-04 00:18:30 +02:00
|
|
|
exit 0;
|
2020-05-01 21:40:25 +02:00
|
|
|
;;
|
|
|
|
DELETE-INDEX)
|
2020-05-02 21:33:39 +02:00
|
|
|
/home/admin/config.scripts/network.txindex.sh delete
|
2021-08-04 00:18:30 +02:00
|
|
|
exit 0;
|
2020-05-01 21:40:25 +02:00
|
|
|
;;
|
2023-01-25 19:07:13 +01:00
|
|
|
REINDEX-UTXO)
|
|
|
|
/home/admin/config.scripts/network.reindex.sh reindex-chainstate mainnet
|
|
|
|
exit 0;
|
|
|
|
;;
|
|
|
|
REINDEX-FULL)
|
|
|
|
/home/admin/config.scripts/network.reindex.sh reindex mainnet
|
2023-01-15 21:51:08 +01:00
|
|
|
exit 0;
|
|
|
|
;;
|
2020-03-29 21:56:25 +02:00
|
|
|
COPY-SOURCE)
|
2021-08-04 00:18:30 +02:00
|
|
|
/home/admin/config.scripts/blitz.copychain.sh source
|
2020-06-18 15:58:27 +02:00
|
|
|
/home/admin/config.scripts/lnd.unlock.sh
|
2020-03-29 21:56:25 +02:00
|
|
|
;;
|
2019-06-19 00:06:05 +02:00
|
|
|
esac
|
2022-01-17 12:40:26 +01:00
|
|
|
|
|
|
|
exit 0
|