raspiblitz/home.admin/98repairMenu.sh

126 lines
3.4 KiB
Bash
Raw Normal View History

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
/home/admin/config.scripts/lnd.rescue.sh backup
echo
echo "PRESS ENTER to continue once your done downloading."
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
/home/admin/config.scripts/lnd.rescue.sh backup no-download
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
}
# Basic Options
OPTIONS=(HARDWARE "Run Hardwaretest" \
SOFTWARE "Run Softwaretest (DebugReport)" \
2019-07-02 19:50:25 +02:00
BACKUP "Backup your LND data (Rescue-File)" \
2019-06-27 22:20:31 +02:00
RESET-CHAIN "Delete Blockchain & Re-Download" \
RESET-LND "Delete LND & start new node/wallet" \
RESET-HDD "Delete HDD Data but keep Blockchain" \
RESET-ALL "Delete HDD completly to start fresh"
)
2019-06-19 00:55:16 +02:00
2019-06-27 22:23:08 +02:00
CHOICE=$(whiptail --clear --title "Repair Options" --menu "" 12 62 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
2019-06-27 22:20:31 +02:00
clear
case $CHOICE in
HARDWARE)
sudo /home/admin/05hardwareTest.sh
/home/admin/00mainMenu.sh
;;
SOFTWARE)
sudo /home/admin/XXdebugLogs.sh
echo "Press ENTER to return to main menu."
read key
/home/admin/00mainMenu.sh
;;
2019-07-02 11:37:00 +02:00
BACKUP)
sudo /home/admin/config.scripts/lnd.rescue.sh backup
echo "Press ENTER to return to main menu."
read key
/home/admin/00mainMenu.sh
;;
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
# 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
2019-08-07 13:10:59 +02:00
_temp="/home/admin/download/dialog.$$"
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 ' ' )
shred $_temp
echo "processing ..."
sleep 3
done
# prepare new name
2019-08-07 13:13:48 +02:00
sudo sed -i "s/^alias=.*/alias=${result}/g" /home/admin/assets/lnd.${network}.conf
sudo sed -i "s/^hostname=.*/hostname=${result}/g" /mnt/hdd/raspiblitz.conf
2019-06-27 22:20:31 +02:00
sudo systemctl stop lnd
sudo rm -r /mnt/hdd/lnd
/home/admin/70initLND.sh
2019-06-27 22:20:31 +02:00
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;
;;
esac