Browse Source

check LND resetup on setup

master
Christian Rotzoll 6 years ago
parent
commit
df75edc4b0
  1. 42
      home.admin/10setupBlitz.sh
  2. 18
      home.admin/70initLND.sh

42
home.admin/10setupBlitz.sh

@ -27,12 +27,22 @@ if [ ${#setupStep} -eq 0 ];then
setupStep=0
fi
# check if LND needs re-setup
if [ ${setupStep} -gt 79 ];then
source <(sudo /home/admin/config.scripts/lnd.check.sh basic-setup)
if [ ${wallet} -eq 0 ] || [ ${macaroon} -eq 0 ] || [ ${config} -eq 0 ] || [ ${tls} -eq 0 ]; then
echo "WARN: LND needs re-setup"
sudo /home/admin/70initLND.sh
exit 0
fi
fi
# if setup if ready --> REBOOT
if [ ${setupStep} -gt 89 ];then
echo "FINISH by setupstep(${setupStep})"
sleep 3
sudo ./90finishSetup.sh
sudo ./95finalSetup.sh
sudo /home/admin/90finishSetup.sh
sudo /home/admin/95finalSetup.sh
exit 0
fi
@ -54,8 +64,8 @@ if [ ${lndRunning} -eq 1 ]; then
fi
if [ ${locked} -gt 0 ]; then
# LND wallet is locked
./AAunlockLND.sh
./10setupBlitz.sh
/home/admin/AAunlockLND.sh
/home/admin/10setupBlitz.sh
exit 0
fi
@ -71,7 +81,7 @@ if [ ${lndRunning} -eq 1 ]; then
if [ ${chainSyncing} -eq 1 ]; then
echo "Sync Chain ..."
sleep 3
./70initLND.sh
/home/admin/70initLND.sh
exit 0
fi
@ -84,15 +94,15 @@ if [ ${lndRunning} -eq 1 ]; then
if [ ${lndSyncing} -eq 1 ]; then
echo "Sync LND ..."
sleep 3
./70initLND.sh
/home/admin/70initLND.sh
exit 0
fi
# if unlocked, blockchain synced and LND synced to chain .. finisch Setup
echo "FINSIH ... "
sleep 3
sudo ./90finishSetup.sh
sudo ./95finalSetup.sh
sudo /home/admin/90finishSetup.sh
sudo /home/admin/95finalSetup.sh
exit 0
fi #end - when lighting is running
@ -113,7 +123,7 @@ fi
if [ ${bitcoinRunning} -eq 1 ]; then
echo "OK - ${network}d is running"
echo "Next step run Lightning"
./70initLND.sh
/home/admin/70initLND.sh
exit 1
else
echo "${network} still not running"
@ -143,7 +153,7 @@ if [ ${mountOK} -eq 1 ]; then
if [ ${blockchainDataExists} -eq 1 ]; then
if [ ${configExists} -eq 1 ]; then
./XXdebugLogs.sh
/home/admin/XXdebugLogs.sh
echo "UNKOWN STATE - there is blockain data config, but blockchain service is not running"
echo "It seems that something went wrong during sync/download/copy of the blockchain."
echo "Or something with the config is not correct."
@ -151,7 +161,7 @@ if [ ${mountOK} -eq 1 ]; then
exit 1
else
echo "Got mounted blockchain, but no config and running service yet --> finish HDD"
./60finishHDD.sh
/home/admin/60finishHDD.sh
exit 1
fi
fi
@ -163,7 +173,7 @@ if [ ${mountOK} -eq 1 ]; then
noScreenSession=$(screen -ls | grep -c "No Sockets found")
if [ ${noScreenSession} -eq 0 ]; then
echo "found torrent data .. resuming"
./50torrentHDD.sh
/home/admin/50torrentHDD.sh
exit 1
fi
fi
@ -175,7 +185,7 @@ if [ ${mountOK} -eq 1 ]; then
noScreenSession=$(screen -ls | grep -c "No Sockets found")
if [ ${noScreenSession} -eq 0 ]; then
echo "found download in data .. resuming"
./50downloadHDD.sh
/home/admin/50downloadHDD.sh
exit 1
fi
fi
@ -235,7 +245,7 @@ fi # end HDD is already auto-mountes
if [ ${setupStep} -eq 0 ]; then
# run initial user dialog
./20setupDialog.sh
/home/admin/20setupDialog.sh
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=20/g" ${infoFile}
@ -247,11 +257,11 @@ formatExt4OK=$(lsblk -o UUID,NAME,FSTYPE,SIZE,LABEL,MODEL | grep BLOCKCHAIN | gr
if [ ${formatExt4OK} -eq 1 ]; then
echo "HDD was already initialized/prepared"
echo "Now needs to be mounted"
./40addHDD.sh
/home/admin/40addHDD.sh
exit 1
fi
# the HDD had no init yet
echo "init HDD ..."
./30initHDD.sh
/home/admin/30initHDD.sh
exit 1

18
home.admin/70initLND.sh

@ -93,8 +93,8 @@ echo ""
echo "*** Starting LND ***"
lndRunning=$(sudo systemctl status lnd.service 2>/dev/null | grep -c running)
if [ ${lndRunning} -eq 0 ]; then
sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.service
sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.service
sed -i "5s/.*/Wants=${network}d.service/" /home/admin/assets/lnd.service
sed -i "6s/.*/After=${network}d.service/" /home/admin/assets/lnd.service
sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service
sudo chmod +x /etc/systemd/system/lnd.service
sudo systemctl enable lnd
@ -154,7 +154,7 @@ if [ ${walletExists} -eq 0 ]; then
# let user enter password c
sudo shred /home/admin/.pass.tmp 2>/dev/null
sudo ./config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /home/admin/.pass.tmp
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`
sudo shred /home/admin/.pass.tmp 2>/dev/null
@ -240,7 +240,7 @@ or having a complete LND rescue-backup from your old node.
##### DEACTIVATED UNTIL config.scripts/lnd.initwallet.py WORKS
# # let user enter password c
# sudo shred /home/admin/.pass.tmp 2>/dev/null
# sudo ./config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /home/admin/.pass.tmp
# 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`
# sudo shred /home/admin/.pass.tmp 2>/dev/null
#
@ -283,7 +283,7 @@ or having a complete LND rescue-backup from your old node.
# " 11 65
# if [ $? -eq 1 ]; then
# sudo shred /home/admin/.pass.tmp 2>/dev/null
# sudo ./config.scripts/blitz.setpassword.sh x "Enter extra Password D" /home/admin/.pass.tmp
# sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /home/admin/.pass.tmp
# passwordD=`sudo cat /home/admin/.pass.tmp`
# sudo shred /home/admin/.pass.tmp 2>/dev/null
# fi
@ -440,7 +440,7 @@ echo ""
echo "*** Copy LND Macaroons to user admin ***"
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
if [ ${macaroonExists} -eq 0 ]; then
./AAunlockLND.sh
/home/admin/AAunlockLND.sh
sleep 3
fi
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
@ -476,7 +476,7 @@ echo "*** Check Wallet Lock ***"
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -c unlock)
if [ ${locked} -gt 0 ]; then
echo "OK - Wallet is locked ... starting unlocking dialog"
./AAunlockLND.sh
/home/admin/AAunlockLND.sh
else
echo "OK - Wallet is already unlocked"
fi
@ -522,5 +522,5 @@ fi
sudo sed -i "s/^setupStep=.*/setupStep=80/g" /home/admin/raspiblitz.info
###### finishSetup
sudo ./90finishSetup.sh
sudo ./95finalSetup.sh
sudo /home/admin/90finishSetup.sh
sudo /home/admin/95finalSetup.sh
Loading…
Cancel
Save