mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-13 06:09:47 +02:00
cl restore: improve file handling and checks
This commit is contained in:
parent
5970f03da9
commit
50e27348db
@ -96,7 +96,7 @@ case $CHOICE in
|
||||
read key
|
||||
# reset
|
||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret
|
||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||
sudo rm -rf /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||
# make sure the new hsm_secret is treated as unencrypted and clear autounlock
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clEncryptedHSM "off"
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clAutoUnlock "off"
|
||||
@ -130,7 +130,7 @@ case $CHOICE in
|
||||
read key
|
||||
# reset
|
||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret
|
||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||
sudo rm -rf /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||
# import file
|
||||
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
|
||||
clear
|
||||
@ -155,14 +155,18 @@ case $CHOICE in
|
||||
read key
|
||||
# reset
|
||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret
|
||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/config
|
||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||
sudo rm -f /home/bitcoin/.lightning/${CLNETWORK}/config
|
||||
sudo rm -rf /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||
# import seed
|
||||
_temp="/var/cache/raspiblitz/.temp.tmp"
|
||||
/home/admin/config.scripts/cl.backup.sh seed-import-gui $_temp
|
||||
source $_temp
|
||||
/home/admin/config.scripts/cl.hsmtool.sh seed-force "$CHAIN" "${seedWords}"
|
||||
sudo rm $_temp 2>/dev/null
|
||||
if ! sudo ls /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret; then
|
||||
echo "# There was no hsm_secret created - exiting"
|
||||
exit 15
|
||||
fi
|
||||
# regenerate config
|
||||
/home/admin/config.scripts/cl.hsmtool.sh autounlock-off
|
||||
/home/admin/config.scripts/cl.hsmtool.sh decrypt
|
||||
|
@ -377,7 +377,7 @@ if [ ${mode} = "seed-import-gui" ]; then
|
||||
sudo chown admin:admin /var/cache/raspiblitz/.seed.tmp
|
||||
|
||||
# dialog to enter
|
||||
dialog --backtitle "RaspiBlitz - C-lightning Recover" --inputbox "Please enter/paste the SEED WORD LIST:\n(just the words, seperated by spaces, in correct order as numbered)" 9 78 2>/var/cache/raspiblitz/.seed.tmp
|
||||
dialog --backtitle "RaspiBlitz - Recover from C-lightning seed" --inputbox "Please enter/paste the SEED WORD LIST:\n(just the words, seperated by spaces, in correct order as numbered)" 9 78 2>/var/cache/raspiblitz/.seed.tmp
|
||||
wordstring=$(cat /var/cache/raspiblitz/.seed.tmp | sed 's/[^a-zA-Z0-9 ]//g')
|
||||
sudo shred -u /var/cache/raspiblitz/.seed.tmp 2>/dev/null
|
||||
echo "processing ..."
|
||||
@ -416,8 +416,8 @@ Please check your list and try again.
|
||||
Best is to write words in external editor
|
||||
and then copy and paste them into dialog.
|
||||
|
||||
The Word list should look like this:
|
||||
wordone wordtweo wordthree ...
|
||||
The word list should look like this:
|
||||
wordone wordtwo wordthree ...
|
||||
|
||||
" 16 52
|
||||
|
||||
|
@ -223,6 +223,10 @@ if [ "$1" = "new" ] || [ "$1" = "new-force" ] || [ "$1" = "seed" ] || [ "$1" = "
|
||||
seedpassword="$4"
|
||||
fi
|
||||
|
||||
if [ "${seedwords}" = "" ]; then
|
||||
echo "# No seedwords - exiting"
|
||||
exit 14
|
||||
fi
|
||||
# place the seedwords to /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
|
||||
sudo touch /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
|
||||
sudo chown bitcoin:bitcoin /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
|
||||
|
Loading…
x
Reference in New Issue
Block a user