mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-20 10:12:06 +01:00
lnd.rescue handling SCB up and down
This commit is contained in:
parent
555e84b286
commit
6455934bfc
@ -227,7 +227,7 @@ if [ ${walletExists} -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# WRNING ON ONLY SEED
|
||||
# WARNING ON ONLY SEED
|
||||
if [ "${CHOICE}" == "ONLYSEED" ]; then
|
||||
whiptail --title "IMPORTANT INFO" --yes-button "Continue" --no-button "Go Back" --yesno "
|
||||
Using JUST SEED WORDS will only recover your on-chain funds.
|
||||
@ -325,50 +325,17 @@ or having a complete LND rescue-backup from your old node.
|
||||
# fi
|
||||
if [ "${CHOICE}" == "SEED+SCB" ]; then
|
||||
|
||||
# get the channel.backup file
|
||||
gotFile=-1
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
while [ ${gotFile} -lt 1 ]
|
||||
do
|
||||
# let lnd.rescue script do the upload process
|
||||
/home/admin/config.scripts/lnd.rescue.sh scb-up
|
||||
|
||||
# show info
|
||||
clear
|
||||
sleep 1
|
||||
echo "**********************************"
|
||||
echo "* UPLOAD THE channel.backup FILE *"
|
||||
echo "**********************************"
|
||||
echo
|
||||
if [ ${gotFile} -eq -1 ]; then
|
||||
echo "If you have the channel.backup file on your laptop or on"
|
||||
echo "another server you can now upload it to the RaspiBlitz."
|
||||
elif [ ${gotFile} -eq 0 ]; then
|
||||
echo "NO channel.backup FOUND IN /home/admin"
|
||||
echo "Please try upload again."
|
||||
fi
|
||||
echo
|
||||
echo "To make upload open a new terminal and change,"
|
||||
echo "into the directory where your lnd-rescue file is and"
|
||||
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
|
||||
echo "scp ./channel.backup admin@${localip}:/home/admin/"
|
||||
echo ""
|
||||
echo "Use password A to authenticate file transfere."
|
||||
echo "PRESS ENTER when upload is done. Enter x & ENTER to cancel."
|
||||
|
||||
# wait user interaction
|
||||
echo "Please upload file. Press ENTER to try again or (x & ENTER) to cancel."
|
||||
read key
|
||||
if [ "${key}" == "x" ]; then
|
||||
/home/admin/70initLND.sh
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# test upload
|
||||
gotFile=$(ls /home/admin/channel.backup | grep -c 'channel.backup')
|
||||
|
||||
done
|
||||
|
||||
clear
|
||||
echo "OK - channel.backup file found."
|
||||
# check exit code of script
|
||||
if [ $? -eq 1 ]; then
|
||||
echo "USER CANCEL --> back to menu"
|
||||
/home/admin/70initLND.sh
|
||||
exit 1
|
||||
else
|
||||
echo "FILE UPLOADED --> will ne checked/activated after wallet restore from seed"
|
||||
fi
|
||||
fi
|
||||
|
||||
##### FALLBACK UNTIL config.scripts/lnd.initwallet.py WORKS
|
||||
|
@ -4,8 +4,15 @@ source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "small rescue script to to backup or restore"
|
||||
echo "lnd.rescue.sh [backup|restore] [?no-download]"
|
||||
echo "# small rescue script to to backup or restore LND data"
|
||||
echo "# -> backup all LND data in a tar.gz file for download:"
|
||||
echo "# lnd.rescue.sh backup [?no-download]"
|
||||
echo "# -> upload a LND data tar.gz file to replace LND data:"
|
||||
echo "# lnd.rescue.sh restore"
|
||||
echo "# -> download the LND channel.backup file from SD card:"
|
||||
echo "# lnd.rescue.sh scb-down"
|
||||
echo "# -> upload the LND channel.backup to recover wallet:"
|
||||
echo "# lnd.rescue.sh scb-up"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -67,10 +74,10 @@ elif [ ${mode} = "restore" ]; then
|
||||
# RESTORE
|
||||
################################
|
||||
|
||||
echo "*** LND.RESCUE --> RESTORE"
|
||||
echo "# LND.RESCUE --> RESTORE"
|
||||
echo ""
|
||||
|
||||
# delete old backups
|
||||
# delete old backups
|
||||
rm /home/admin/lnd-rescue-*.tar.gz
|
||||
|
||||
filename=""
|
||||
@ -169,6 +176,69 @@ elif [ ${mode} = "restore" ]; then
|
||||
echo "Keep in mind that some channels maybe forced closed in the meanwhile."
|
||||
echo
|
||||
|
||||
elif [ ${mode} = "scb-down" ]; then
|
||||
|
||||
echo
|
||||
echo "****************************"
|
||||
echo "* DOWNLOAD THE BACKUP FILE *"
|
||||
echo "****************************"
|
||||
echo
|
||||
echo "RUN THE FOLLOWING COMMAND ON YOUR LAPTOP IN NEW TERMINAL:"
|
||||
echo "scp -r admin@${localip}:/home/admin/.lnd/data/chain/${network}/${chain}net/channel.backup ./"
|
||||
echo ""
|
||||
echo "Use password A to authenticate file transfere."
|
||||
echo
|
||||
echo "NOTE: Use this file when setting up a fresh RaspiBlitz by choosing"
|
||||
echo "option OLD WALLET and then SCB+SEED -> Seed & channel.backup file"
|
||||
echo "Will just recover on-chain & channel-funds, but closing all channels"
|
||||
|
||||
elif [ ${mode} = "scb-up" ]; then
|
||||
|
||||
gotFile=-1
|
||||
while [ ${gotFile} -lt 1 ]
|
||||
do
|
||||
|
||||
# show info
|
||||
clear
|
||||
sleep 1
|
||||
echo "**********************************"
|
||||
echo "* UPLOAD THE channel.backup FILE *"
|
||||
echo "**********************************"
|
||||
echo
|
||||
if [ ${gotFile} -eq -1 ]; then
|
||||
echo "If you have the channel.backup file on your laptop or on"
|
||||
echo "another server you can now upload it to the RaspiBlitz."
|
||||
elif [ ${gotFile} -eq 0 ]; then
|
||||
echo "NO channel.backup FOUND IN /home/admin"
|
||||
echo "Please try upload again."
|
||||
fi
|
||||
echo
|
||||
echo "To make upload open a new terminal and change,"
|
||||
echo "into the directory where your lnd-rescue file is and"
|
||||
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
|
||||
echo "scp ./channel.backup admin@${localip}:/home/admin/"
|
||||
echo ""
|
||||
echo "Use password A to authenticate file transfere."
|
||||
echo "PRESS ENTER when upload is done. Enter x & ENTER to cancel."
|
||||
|
||||
# wait user interaction
|
||||
echo "Please upload file. Press ENTER to try again or (x & ENTER) to cancel."
|
||||
read key
|
||||
if [ "${key}" == "x" ]; then
|
||||
# EXIT with CODE 1 --> USER CANCEL
|
||||
echo "# CANCEL upload"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# test upload
|
||||
gotFile=$(ls /home/admin/channel.backup | grep -c 'channel.backup')
|
||||
|
||||
done
|
||||
|
||||
# EXIT with CODE 1 --> FILE UPLOADED
|
||||
echo "# OK channel.backup uploaded"
|
||||
exit 0
|
||||
|
||||
else
|
||||
echo "unknown parameter '${mode}' - exit"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user