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()
|
|
|
|
{
|
|
|
|
whiptail --title "LND Data Backup" --yes-button "Backup" --no-button "Skip" --yesno "
|
|
|
|
Before deleting your data, do you want
|
|
|
|
to make a backup of all your LND Data
|
|
|
|
and download that file to your laptop?
|
2019-06-19 00:06:05 +02:00
|
|
|
|
2019-06-27 22:20:31 +02:00
|
|
|
Download LND Data Backup now?
|
|
|
|
" 12 44
|
2019-06-19 00:55:16 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
clear
|
|
|
|
echo "*************************************"
|
|
|
|
echo "* PREPARING LND BACKUP DOWNLOAD"
|
|
|
|
echo "*************************************"
|
|
|
|
echo "please wait .."
|
|
|
|
sleep 2
|
2021-08-04 00:18:30 +02:00
|
|
|
/home/admin/config.scripts/lnd.backup.sh lnd-export-gui
|
2019-06-19 00:55:16 +02:00
|
|
|
echo
|
2020-02-28 10:14:37 +01:00
|
|
|
echo "PRESS ENTER to continue once you are done downloading."
|
2019-06-19 00:55:16 +02:00
|
|
|
read key
|
|
|
|
else
|
|
|
|
clear
|
|
|
|
echo "*************************************"
|
2019-08-07 13:13:48 +02:00
|
|
|
echo "* JUST MAKING BACKUP TO SD CARD"
|
2019-06-19 00:55:16 +02:00
|
|
|
echo "*************************************"
|
|
|
|
echo "please wait .."
|
|
|
|
sleep 2
|
2021-08-04 00:18:30 +02:00
|
|
|
/home/admin/config.scripts/lnd.backup.sh lnd-export
|
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
|
|
|
|
}
|
|
|
|
|
2021-08-30 21:14:58 +02:00
|
|
|
OPTIONS=()
|
|
|
|
#OPTIONS+=(HARDWARE "Run Hardwaretest")
|
|
|
|
OPTIONS+=(SOFTWARE "Run Softwaretest (DebugReport)")
|
|
|
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
|
|
|
OPTIONS+=(BACKUP-LND "Backup your LND data (Rescue-File)")
|
|
|
|
OPTIONS+=(RESET-LND "Delete LND & start new node/wallet")
|
|
|
|
fi
|
2021-09-26 11:30:09 +02:00
|
|
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
|
|
|
OPTIONS+=(REPAIR-CL "Repair/Backup C-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")
|
|
|
|
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")
|
|
|
|
OPTIONS+=(DELETE-INDEX "Delete Bitcoin Transaction-Index")
|
2019-06-19 00:55:16 +02:00
|
|
|
|
2020-05-02 21:30:06 +02:00
|
|
|
CHOICE=$(whiptail --clear --title "Repair Options" --menu "" 18 62 11 "${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)
|
2021-08-04 00:18:30 +02:00
|
|
|
sudo /home/admin/config.scripts/blitz.debug.sh
|
2019-06-27 22:20:31 +02:00
|
|
|
echo "Press ENTER to return to main menu."
|
|
|
|
read key
|
|
|
|
;;
|
2020-02-14 13:12:57 +01:00
|
|
|
BACKUP-LND)
|
2021-08-04 00:18:30 +02:00
|
|
|
sudo /home/admin/config.scripts/lnd.backup.sh lnd-export-gui
|
2020-02-18 14:19:26 +01:00
|
|
|
echo
|
2020-02-18 14:21:30 +01:00
|
|
|
echo "Press ENTER when your backup download is done to shutdown."
|
2019-07-02 11:37:00 +02:00
|
|
|
read key
|
2021-08-04 00:18:30 +02:00
|
|
|
/home/admin/config.scripts/blitz.shutdown.sh
|
2019-07-02 11:37:00 +02:00
|
|
|
;;
|
2021-09-26 11:30:09 +02:00
|
|
|
REPAIR-CL)
|
|
|
|
sudo /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)
|
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-LND)
|
|
|
|
askBackupCopy
|
2019-08-07 12:56:28 +02:00
|
|
|
# ask for a new name so that network analysis has harder time to connect new node id with old
|
|
|
|
result=""
|
|
|
|
while [ ${#result} -eq 0 ]
|
|
|
|
do
|
2021-09-02 12:34:30 +02:00
|
|
|
trap 'rm -f "$_temp"' EXIT
|
2021-03-16 21:43:34 +01:00
|
|
|
_temp=$(mktemp -p /dev/shm/)
|
2019-08-07 12:56:28 +02:00
|
|
|
l1="Please enter the new name of your LND node:\n"
|
|
|
|
l2="different name is better for a fresh identity\n"
|
|
|
|
l3="one word, keep characters basic & not too long"
|
|
|
|
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --inputbox "$l1$l2$l3" 13 52 2>$_temp
|
|
|
|
result=$( cat $_temp | tr -dc '[:alnum:]-.' | tr -d ' ' )
|
|
|
|
echo "processing ..."
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
|
2020-04-18 01:23:36 +02:00
|
|
|
# make sure host is named like in the raspiblitz config
|
|
|
|
echo "Setting the Name/Alias/Hostname .."
|
2021-08-04 00:18:30 +02:00
|
|
|
sudo /home/admin/config.scripts/lnd.setname.sh mainnet ${result}
|
2020-04-18 01:24:07 +02:00
|
|
|
sudo sed -i "s/^hostname=.*/hostname=${result}/g" /mnt/hdd/raspiblitz.conf
|
2020-04-18 01:23:36 +02:00
|
|
|
|
|
|
|
echo "stopping lnd ..."
|
2019-06-27 22:20:31 +02:00
|
|
|
sudo systemctl stop lnd
|
|
|
|
sudo rm -r /mnt/hdd/lnd
|
2021-11-02 13:19:33 +01:00
|
|
|
# create wallet
|
|
|
|
/home/admin/config.scripts/lnd.install.sh on mainnet initwallet
|
|
|
|
# display and delete the seed for mainnet
|
|
|
|
sudo /home/admin/config.scripts/lnd.install.sh display-seed mainnet delete
|
|
|
|
if [ "${tlnd}" == "on" ];then
|
|
|
|
/home/admin/config.scripts/lnd.install.sh on testnet initwallet
|
|
|
|
fi
|
|
|
|
if [ "${slnd}" == "on" ];then
|
|
|
|
/home/admin/config.scripts/lnd.install.sh on signet initwallet
|
|
|
|
fi
|
2020-04-17 19:28:32 +02:00
|
|
|
# go back to main menu (and show)
|
|
|
|
/home/admin/00raspiblitz.sh
|
2021-08-04 00:18:30 +02:00
|
|
|
exit 0;
|
2019-06-27 22:20:31 +02:00
|
|
|
;;
|
|
|
|
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
|
|
|
;;
|
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
|