2018-12-05 00:07:58 +01:00
#!/bin/bash
2018-07-17 13:12:03 +02:00
2018-12-06 14:36:02 +01:00
## get basic info
2019-02-12 16:12:20 +01:00
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
2018-08-08 17:36:04 +02:00
2019-12-13 19:21:59 +01:00
echo ""
2019-12-18 00:35:05 +01:00
echo "*** 70initLND.sh ***"
2019-12-13 19:21:59 +01:00
2019-04-13 00:13:24 +01:00
# CHECK #########
echo "*** Check Basic Config ***"
if [ ${# network } -eq 0 ] ; then
echo "FAIL - missing: network"
exit 1
fi
if [ ${# chain } -eq 0 ] ; then
echo "FAIL - missing: chain"
exit 1
fi
# CHECK #########
echo " *** Check ${ network } Running *** "
2018-08-24 03:26:57 +02:00
bitcoinRunning = $( systemctl status ${ network } d.service 2>/dev/null | grep -c running)
2018-08-24 12:42:18 +02:00
if [ ${ bitcoinRunning } -eq 0 ] ; then
2019-01-15 15:24:29 +01:00
bitcoinRunning = $( sudo -u bitcoin ${ network } -cli -datadir= /home/bitcoin/.${ network } getblockchaininfo | grep -c verificationprogress)
2018-08-24 12:40:22 +02:00
fi
2019-04-13 00:13:24 +01:00
if [ ${ bitcoinRunning } -eq 0 ] ; then
whiptail --title "70initLND - WARNING" --yes-button "Retry" --no-button "EXIT+Logs" --yesno " Service ${ network } d is not running. " 8 50
if [ $? -eq 0 ] ; then
/home/admin/70initLND.sh
else
/home/admin/XXdebugLogs.sh
fi
exit 1
2018-07-17 13:12:03 +02:00
fi
2019-04-13 00:13:24 +01:00
# CHECK #########
2019-05-03 13:25:04 +02:00
echo " *** Check ${ network } Responding *** (can take a while) "
2019-04-13 00:13:24 +01:00
chainIsReady = 0
loopCount = 0
while [ ${ chainIsReady } -eq 0 ]
do
loopCount = $(( $loopCount + 1 ))
result = $( sudo -u bitcoin ${ network } -cli -datadir= /home/bitcoin/.${ network } getblockchaininfo 2>error.out)
error = ` cat error.out`
rm error.out
if [ ${# error } -gt 0 ] ; then
if [ ${ loopCount } -gt 33 ] ; then
echo "*** TAKES LONGER THEN EXCEPTED ***"
date +%s
echo " result( ${ result } ) "
echo " error( ${ error } ) "
testnetAdd = ""
if [ " ${ chain } " = "test" ] ; then
testnetAdd = "testnet3/"
fi
sudo tail -n 5 /mnt/hdd/${ network } /${ testnetAdd } debug.log
echo "If you see an error -28 relax, just give it some time."
echo "Waiting 1 minute and then trying again ..."
sleep 60
else
echo " ( ${ loopCount } /33) still waiting .. "
sleep 10
fi
else
echo "OK - chainnetwork is working"
echo ""
chainIsReady = 1
break
fi
done
# CHECK #########
echo "*** Check LND Config ***"
2019-04-25 19:31:17 +02:00
configExists = $( sudo ls /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep -c lnd.conf )
2018-07-17 13:12:03 +02:00
if [ ${ configExists } -eq 0 ] ; then
2019-06-27 23:48:11 +02:00
echo "Creating LND config ..."
sudo mkdir /mnt/hdd/lnd 2> /dev/null
2019-06-27 23:58:02 +02:00
sudo chown -R bitcoin:bitcoin /mnt/hdd/lnd
2018-07-31 20:13:08 +02:00
sudo cp /home/admin/assets/lnd.${ network } .conf /mnt/hdd/lnd/lnd.conf
2019-04-25 18:27:52 +02:00
source <( sudo cat /mnt/hdd/${ network } /${ network } .conf 2>/dev/null | grep "rpcpassword" | sed 's/^[a-z]*\./lnd/g' )
2019-04-25 20:02:04 +02:00
sudo sed -i " s/^ ${ network } d.rpcpass=.*/ ${ network } d.rpcpass= ${ rpcpassword } /g " /mnt/hdd/lnd/lnd.conf
2018-07-17 13:12:03 +02:00
sudo chown bitcoin:bitcoin /mnt/hdd/lnd/lnd.conf
if [ -d /home/bitcoin/.lnd ] ; then
echo "OK - LND config written"
else
echo "FAIL - Was not able to setup LND"
exit 1
fi
else
echo "OK - exists"
fi
echo ""
2019-06-13 02:27:19 +02:00
###### Init LND service & start
2019-04-13 00:13:24 +01:00
2019-06-13 02:27:19 +02:00
echo "*** Init LND Service & Start ***"
2019-01-29 12:24:37 +00:00
lndRunning = $( sudo systemctl status lnd.service 2>/dev/null | grep -c running)
2018-07-17 13:12:03 +02:00
if [ ${ lndRunning } -eq 0 ] ; then
2019-06-13 02:27:19 +02:00
2020-04-18 01:23:36 +02:00
echo "stopping lnd .."
2019-04-25 17:44:32 +02:00
sudo systemctl stop lnd 2>/dev/null
sudo systemctl disable lnd 2>/dev/null
2019-06-13 02:27:19 +02:00
2019-04-25 15:47:13 +02:00
sed -i " 5s/.*/Wants= ${ network } d.service/ " /home/admin/assets/lnd.service
sed -i " 6s/.*/After= ${ network } d.service/ " /home/admin/assets/lnd.service
2018-07-29 12:21:52 +02:00
sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service
2019-06-28 11:23:34 +02:00
#sudo chmod +x /etc/systemd/system/lnd.service
2019-06-13 02:27:19 +02:00
###### ACTIVATE TOR IF SET DURING SETUP
if [ " ${ runBehindTor } " = "on" ] ; then
2019-08-08 18:39:43 +02:00
echo "TOR was selected"
2019-08-08 17:41:58 +02:00
sudo /home/admin/config.scripts/internet.tor.sh lndconf-on
2019-06-13 02:27:19 +02:00
else
echo "TOR was not selected"
fi
2019-12-14 12:53:48 +01:00
echo "Starting LND Service ..."
2018-07-17 13:12:03 +02:00
sudo systemctl enable lnd
sudo systemctl start lnd
2019-12-14 12:53:48 +01:00
2019-01-16 21:17:44 +01:00
echo ""
2019-07-01 01:01:38 +02:00
echo "waiting ."
sleep 10
echo "waiting .."
sleep 10
echo "waiting ..."
sleep 10
dialog --pause " Starting LND - please wait .." 8 58 90
2018-07-17 13:12:03 +02:00
fi
2019-04-13 00:13:24 +01:00
###### Check LND starting
2018-08-23 21:54:37 +02:00
while [ ${ lndRunning } -eq 0 ]
do
2019-01-29 12:24:37 +00:00
lndRunning = $( sudo systemctl status lnd.service | grep -c running)
2018-08-23 21:54:37 +02:00
if [ ${ lndRunning } -eq 0 ] ; then
date +%s
echo "LND not ready yet ... waiting another 60 seconds."
echo "If this takes too long (more then 10min total) --> CTRL+c and report Problem"
sleep 60
fi
done
2018-07-17 13:12:03 +02:00
echo "OK - LND is running"
echo ""
2019-04-13 00:13:24 +01:00
###### Check LND health/fails (to be extended)
fail = ""
tlsExists = $( sudo ls /mnt/hdd/lnd/tls.cert 2>/dev/null | grep -c "tls.cert" )
if [ ${ tlsExists } -eq 0 ] ; then
fail = "LND was starting, but missing /mnt/hdd/lnd/tls.cert"
fi
if [ ${# fail } -gt 0 ] ; then
whiptail --title "70initLND - WARNING" --yes-button "Retry" --no-button "EXIT+Logs" --yesno " ${ fail } " 8 50
if [ $? -eq 0 ] ; then
/home/admin/70initLND.sh
else
/home/admin/XXdebugLogs.sh
fi
exit 1
fi
###### Instructions on Creating/Restoring LND Wallet
2018-08-08 19:50:46 +02:00
walletExists = $( sudo ls /mnt/hdd/lnd/data/chain/${ network } /${ chain } net/wallet.db 2>/dev/null | grep wallet.db -c)
2018-08-09 11:54:15 +02:00
echo " walletExists( ${ walletExists } ) "
2018-08-09 12:04:31 +02:00
sleep 2
2018-08-08 17:36:04 +02:00
if [ ${ walletExists } -eq 0 ] ; then
2018-08-09 02:22:27 +02:00
2019-04-13 00:13:24 +01:00
# UI: Ask if user wants NEW wallet or RECOVER a wallet
OPTIONS = ( NEW "Setup a brand new Lightning Node (DEFAULT)" \
OLD "I had a old Node I want to recover/restore" )
2019-04-14 22:44:10 +01:00
CHOICE = $( dialog --backtitle "RaspiBlitz" --clear --title "LND Setup" --menu "LND Data & Wallet" 11 60 6 " ${ OPTIONS [@] } " 2>& 1 >/dev/tty)
2019-04-13 00:13:24 +01:00
echo " choice( $CHOICE ) "
2018-08-09 10:48:51 +02:00
2019-04-13 00:13:24 +01:00
if [ " ${ CHOICE } " = = "NEW" ] ; then
2018-08-24 23:29:22 +02:00
2019-04-16 14:10:06 +01:00
############################
# NEW WALLET
############################
2019-04-13 00:13:24 +01:00
# let user enter password c
2020-05-02 11:32:04 +02:00
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
2019-04-25 15:47:13 +02:00
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /home/admin/.pass.tmp
2019-04-13 00:13:24 +01:00
passwordC = ` sudo cat /home/admin/.pass.tmp`
2020-05-02 11:32:04 +02:00
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
2019-04-13 00:13:24 +01:00
# make sure passwordC is set
if [ ${# passwordC } -eq 0 ] ; then
/home/admin/70initLND.sh
exit 1
fi
# generate wallet with seed and set passwordC
2019-07-29 23:33:29 +02:00
clear
2019-04-15 02:03:08 +01:00
echo "Generating new Wallet ...."
2019-11-27 08:49:11 +01:00
source /home/admin/python3-env-lnd/bin/activate
2019-12-17 17:53:14 +01:00
python3 /home/admin/config.scripts/lnd.initwallet.py new ${ passwordC } > /home/admin/.seed.tmp
2019-04-13 00:13:24 +01:00
source /home/admin/.seed.tmp
2020-05-02 11:32:04 +02:00
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
2019-04-13 00:13:24 +01:00
# in case of error - retry
2019-04-14 22:44:10 +01:00
if [ ${# err } -gt 0 ] ; then
2019-12-17 17:53:14 +01:00
whiptail --title "lnd.initwallet.py - ERROR" --msgbox " ${ err } " 8 50
2019-04-13 00:13:24 +01:00
/home/admin/70initLND.sh
exit 1
2019-04-14 22:44:10 +01:00
else
if [ ${# seedwords } -eq 0 ] ; then
echo "FAIL!! -> MISSING seedwords data - but also no err data ?!?"
2019-04-15 00:12:32 +01:00
echo "CHECK output data above - PRESS ENTER to restart 70initLND.sh"
2019-04-14 22:44:10 +01:00
read key
/home/admin/70initLND.sh
exit 1
fi
2019-04-13 00:13:24 +01:00
fi
2019-04-15 01:33:29 +01:00
if [ ${# seedwords6x4 } -eq 0 ] ; then
seedwords6x4 = " ${ seedwords } "
fi
2019-04-13 00:13:24 +01:00
ack = 0
while [ ${ ack } -eq 0 ]
do
2019-04-15 02:05:58 +01:00
whiptail --title "IMPORTANT SEED WORDS - PLEASE WRITE DOWN" --msgbox " LND Wallet got created. Store these numbered words in a safe location:\n\n ${ seedwords6x4 } " 12 76
2019-04-15 01:15:57 +01:00
whiptail --title "Please Confirm" --yes-button "Show Again" --no-button "CONTINUE" --yesno " Are you sure that you wrote down the word list?" 8 55
2019-04-13 00:13:24 +01:00
if [ $? -eq 1 ] ; then
ack = 1
fi
done
2019-06-27 22:20:31 +02:00
if [ ${ setupStep } -lt 100 ] ; then
sudo sed -i "s/^setupStep=.*/setupStep=65/g" /home/admin/raspiblitz.info
fi
2019-04-13 00:13:24 +01:00
2020-04-17 21:51:05 +02:00
echo "waiting ."
sleep 10
2019-04-13 00:13:24 +01:00
else
2019-04-16 14:10:06 +01:00
############################
# RECOVER OLD WALLET
############################
2019-04-16 02:34:38 +01:00
OPTIONS = ( LNDRESCUE "LND tar.gz-Backupfile (BEST)" \
2019-04-16 12:39:29 +01:00
SEED+SCB "Seed & channel.backup file (OK)" \
2019-04-16 02:34:38 +01:00
ONLYSEED "Only Seed Word List (FALLBACK)" )
2019-04-16 03:06:58 +01:00
CHOICE = $( dialog --backtitle "RaspiBlitz" --clear --title "RECOVER LND DATA & WALLET" --menu "Data you have to recover from?" 11 60 6 " ${ OPTIONS [@] } " 2>& 1 >/dev/tty)
2019-04-16 02:34:38 +01:00
2019-04-16 16:01:57 +01:00
# LND RESCUE
if [ " ${ CHOICE } " = = "LNDRESCUE" ] ; then
sudo /home/admin/config.scripts/lnd.rescue.sh restore
echo ""
echo "PRESS ENTER to continue."
read key
/home/admin/70initLND.sh
exit 1
fi
2020-04-17 22:30:53 +02:00
# recovering from an old wallet while node is not synced is not possible at the moment
# because LND will forget the recovery window on restart and not be able to recover funds
# TODO: https://github.com/rootzoll/raspiblitz/issues/1126
if [ ${ setupStep } -lt 100 ] ; then
if [ " ${ CHOICE } " = = "ONLYSEED" ] || [ " ${ CHOICE } " = = "SEED+SCB" ] ; then
whiptail --title "UNDER CONSTRUCTION" --msgbox "
To recover an old wallet from SEED or SEED+SCB please
create an empty NEW WALLET first and setup everything
2020-04-17 23:21:37 +02:00
else until you get to the main menu.
2020-04-17 22:30:53 +02:00
Then once your in the MAIN MENU go to REPAIR > RESET-LND
skip all the backups and recover your old wallet.
Sorry, this process will be optimized soon.
" 15 63
/home/admin/70initLND.sh
exit 1
fi
fi
2019-04-26 16:36:03 +02:00
# WARNING ON ONLY SEED
2019-04-16 14:10:06 +01:00
if [ " ${ CHOICE } " = = "ONLYSEED" ] ; then
2020-04-17 22:30:53 +02:00
# ket people know about the difference between SEED & SEED+SCB
2019-04-16 14:10:06 +01:00
whiptail --title "IMPORTANT INFO" --yes-button "Continue" --no-button "Go Back" --yesno "
Using JUST SEED WORDS will only recover your on-chain funds.
To also try to recover the open channel funds you need the
channel.backup file ( since RaspiBlitz v1.2 / LND 0.6-beta)
or having a complete LND rescue-backup from your old node.
" 11 65
if [ $? -eq 1 ] ; then
/home/admin/70initLND.sh
exit 1
fi
fi
2019-05-01 00:35:09 +02:00
# IF SEED and SCB - make user upload channel.backup file now
# and it will get automated activated after syns are ready
# TODO: later activate directly with call to lnd.iniwallet.py
2019-04-16 16:01:57 +01:00
if [ " ${ CHOICE } " = = "SEED+SCB" ] ; then
2019-04-16 12:46:32 +01:00
2019-04-26 16:36:03 +02:00
# let lnd.rescue script do the upload process
/home/admin/config.scripts/lnd.rescue.sh scb-up
2019-04-16 12:46:32 +01:00
2019-04-26 16:36:03 +02:00
# check exit code of script
if [ $? -eq 1 ] ; then
echo "USER CANCEL --> back to menu"
/home/admin/70initLND.sh
exit 1
else
2019-04-26 17:49:27 +02:00
clear
2020-02-19 11:00:51 +01:00
echo "channel.backup will get checked/activated after blockchain/lightning is synced"
sleep 2
echo "NEXT --> Set password for new LND wallet"
sleep 3
2019-04-26 16:36:03 +02:00
fi
2019-04-16 16:03:55 +01:00
fi
2019-04-16 14:10:06 +01:00
2019-05-01 00:35:09 +02:00
clear
# let user enter password c
2020-05-02 11:32:04 +02:00
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
2019-05-01 00:35:09 +02:00
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /home/admin/.pass.tmp
passwordC = ` sudo cat /home/admin/.pass.tmp`
2020-05-02 11:32:04 +02:00
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
2019-05-01 00:35:09 +02:00
# get seed word list
if [ " ${ CHOICE } " = = "SEED+SCB" ] || [ " ${ CHOICE } " = = "ONLYSEED" ] ; then
2019-05-01 00:44:01 +02:00
wordsCorrect = 0
while [ ${ wordsCorrect } -eq 0 ]
do
# dialog to enter
2019-05-01 00:58:00 +02:00
dialog --backtitle "RaspiBlitz - LND Recover" --inputbox "Please enter/paste the SEED WORD LIST:\n(just the words, seperated by spaces, in correct order as numbered)" 9 78 2>/home/admin/.seed.tmp
2019-05-01 01:01:39 +02:00
wordstring = $( cat /home/admin/.seed.tmp | sed 's/[^a-zA-Z0-9 ]//g' )
2020-05-02 11:32:04 +02:00
shred -u /home/admin/.seed.tmp
2019-05-01 00:44:01 +02:00
echo " processing ... ${ wordstring } "
# check correct number of words
2019-05-01 00:48:01 +02:00
wordcount = $( echo " ${ wordstring } " | wc -w)
if [ ${ wordcount } -eq 24 ] ; then
2019-05-01 00:44:01 +02:00
echo "OK - 24 words"
wordsCorrect = 1
else
whiptail --title " WARNING " \
--yes-button "Try Again" \
--no-button "Cancel" \
--yesno "
2019-05-01 00:48:01 +02:00
The word list has ${ wordcount } words. But it must be 24.
2019-05-01 00:35:09 +02:00
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:
2019-05-01 00:37:53 +02:00
wordone wordtweo wordthree ...
2019-05-01 00:35:09 +02:00
" 16 52
2019-05-01 00:44:01 +02:00
if [ $? -eq 1 ] ; then
/home/admin/70initLND.sh
exit 1
fi
fi
done
2019-05-01 00:35:09 +02:00
# ask if seed was protected by password D
passwordD = ""
dialog --title "SEED PASSWORD" --yes-button "No extra Password" --no-button "Yes" --yesno "
Are your seed words protected by an extra password?
During wallet creation LND offers to set an extra password
to protect the seed words. Most users did not set this.
" 11 65
if [ $? -eq 1 ] ; then
2020-05-02 11:32:04 +02:00
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
2019-05-01 00:35:09 +02:00
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /home/admin/.pass.tmp
passwordD = ` sudo cat /home/admin/.pass.tmp`
2020-05-02 11:32:04 +02:00
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
2019-05-01 00:35:09 +02:00
fi
2019-04-16 02:57:18 +01:00
2019-04-16 02:34:38 +01:00
fi
2019-05-01 00:35:09 +02:00
# FOR NOW: let channel.backup file get activated by lncli after syncs
# LATER: make different call to lnd.initwallet.py
if [ " ${ CHOICE } " = = "SEED+SCB" ] || [ " ${ CHOICE } " = = "ONLYSEED" ] ; then
# trigger wallet recovery
2019-11-27 08:49:11 +01:00
source /home/admin/python3-env-lnd/bin/activate
2020-02-19 10:52:06 +01:00
source <( python3 /home/admin/config.scripts/lnd.initwallet.py seed ${ passwordC } " ${ wordstring } " ${ passwordD } 2>/dev/null)
2019-05-01 00:35:09 +02:00
# check if wallet was created for real
if [ ${# err } -eq 0 ] ; then
walletExists = $( sudo ls /mnt/hdd/lnd/data/chain/${ network } /${ chain } net/wallet.db 2>/dev/null | grep wallet.db -c)
if [ ${ walletExists } -eq 0 ] ; then
err = "Was not able to create wallet (unknown error)."
fi
fi
# user feedback
if [ ${# err } -eq 0 ] ; then
dialog --title " SUCCESS " --msgbox "
Looks good :) LND was able to recover the wallet.
2020-02-19 14:18:31 +01:00
2020-04-17 19:28:32 +02:00
IMPORTANT: Please dont reboot the RaspiBlitz until
the LND was able to rescan the Blockchain again.
2020-04-17 20:21:47 +02:00
" 10 60
2020-04-17 21:51:05 +02:00
clear
2020-04-17 20:21:47 +02:00
2019-05-01 00:35:09 +02:00
else
whiptail --title " FAIL " --msgbox "
Something went wrong - see info below:
2019-05-01 01:12:33 +02:00
2019-05-01 00:35:09 +02:00
${ err }
${ errMore }
" 13 72
2020-02-19 11:05:44 +01:00
clear
echo "Restarting LND Wallet Setup .."
sleep 2
echo
2019-05-01 00:35:09 +02:00
/home/admin/70initLND.sh
exit 1
fi
fi
2019-04-16 16:01:57 +01:00
2019-04-16 16:03:55 +01:00
fi # END OLD WALLET
2018-08-08 17:36:04 +02:00
2019-04-14 22:09:59 +01:00
else
echo "OK - LND wallet already exists."
fi
2020-04-17 21:51:05 +02:00
echo "waiting .."
sleep 10
2020-04-17 20:21:47 +02:00
dialog --pause " Waiting for LND - please wait .." 8 58 45
2018-07-17 13:12:03 +02:00
2019-04-16 14:10:06 +01:00
############################
# Copy LND macaroons to admin
############################
2020-01-08 14:17:57 +01:00
clear
2018-07-17 13:12:03 +02:00
echo ""
echo "*** Copy LND Macaroons to user admin ***"
2020-04-17 21:51:05 +02:00
# check if macaroon exists and if not try to unlock LND wallet first
2018-12-10 17:52:39 +01:00
macaroonExists = $( sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${ network } /${ chain } net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
2018-08-09 12:04:31 +02:00
if [ ${ macaroonExists } -eq 0 ] ; then
2019-04-25 15:47:13 +02:00
/home/admin/AAunlockLND.sh
2018-08-09 12:04:31 +02:00
sleep 3
fi
2020-04-17 21:51:05 +02:00
2020-05-01 11:49:03 +02:00
# check if macaroon exists now - if not fail
2018-12-10 17:52:39 +01:00
macaroonExists = $( sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${ network } /${ chain } net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
2018-07-17 13:12:03 +02:00
if [ ${ macaroonExists } -eq 0 ] ; then
2018-08-24 21:57:13 +02:00
sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${ network } /${ chain } net/admin.macaroon
2018-07-17 13:12:03 +02:00
echo ""
echo "FAIL - LND Macaroons not created"
echo "Please check the following LND issue:"
echo "https://github.com/lightningnetwork/lnd/issues/890"
2018-08-07 16:28:15 +02:00
echo "You may want try again with starting ./70initLND.sh"
2018-07-17 13:12:03 +02:00
exit 1
fi
2020-04-17 20:21:47 +02:00
2020-04-17 21:51:05 +02:00
# copy macaroons to all needed users
2020-05-01 11:15:32 +02:00
sudo /home/admin/config.scripts/lnd.credentials.sh sync
2020-04-17 21:51:05 +02:00
echo "OK - LND Macaroons created and copied"
echo ""
2018-07-17 13:12:03 +02:00
###### Unlock Wallet (if needed)
echo "*** Check Wallet Lock ***"
2019-05-09 20:06:43 +02:00
locked = $( sudo tail -n 1 /mnt/hdd/lnd/logs/${ network } /${ chain } net/lnd.log 2>/dev/null | grep -c unlock)
2018-07-17 13:12:03 +02:00
if [ ${ locked } -gt 0 ] ; then
echo "OK - Wallet is locked ... starting unlocking dialog"
2019-04-25 15:47:13 +02:00
/home/admin/AAunlockLND.sh
2018-07-17 13:12:03 +02:00
else
echo "OK - Wallet is already unlocked"
fi
2019-04-16 16:01:57 +01:00
echo ""
2019-06-27 22:20:31 +02:00
if [ ${ setupStep } -lt 100 ] ; then
# set SetupState (scan is done - so its 80%)
sudo sed -i "s/^setupStep=.*/setupStep=80/g" /home/admin/raspiblitz.info
###### finishSetup
sudo /home/admin/90finishSetup.sh
sudo /home/admin/95finalSetup.sh
else
2020-04-17 19:28:32 +02:00
# its important that RaspiBlitz dont get rebooted
# before LND rescan is finished
2019-06-27 22:20:31 +02:00
whiptail --title "RESET DONE" --msgbox "
OK LND Reset is done .
2020-04-17 18:25:13 +02:00
You may now give it
2020-04-17 19:28:32 +02:00
extra time to rescan.
2020-04-17 18:25:13 +02:00
" 10 25
2019-08-07 13:53:47 +02:00
2019-12-13 19:21:59 +01:00
fi