macaroon check

This commit is contained in:
rootzoll 2018-12-05 01:12:45 +01:00
parent bae273e028
commit ba5d7e1d16

View File

@ -68,10 +68,20 @@ if [ "${chain}" != "${choice}" ]; then
sudo -u bitcoin /usr/local/bin/lncli --chain=${network} create 2>error.out sudo -u bitcoin /usr/local/bin/lncli --chain=${network} create 2>error.out
error=`sudo cat error.out` error=`sudo cat error.out`
if [ ${#error} -eq 0 ]; then if [ ${#error} -eq 0 ]; then
sleep 2
macaroonExists=$(sudo ls /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon | grep -c 'admin.macaroon')
if [ ${macaroonExists} -eq 1 ]; then
# WIN # WIN
tryAgain=0 tryAgain=0
echo "!!! Make sure to write down the 24 words (cipher seed mnemonic) !!!" echo "!!! Make sure to write down the 24 words (cipher seed mnemonic) !!!"
echo "If you are ready. Press ENTER." echo "If you are ready. Press ENTER."
else
# FAIL - no macaroon
tryAgain=1
echo "!!! FAIL ---> No macaroon found:"
echo "/home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon"
echo "Press ENTER to retry ... or CTRL-c to EXIT"
fi
else else
# FAIL # FAIL
tryAgain=1 tryAgain=1
@ -86,7 +96,7 @@ if [ "${chain}" != "${choice}" ]; then
sudo systemctl stop lnd sudo systemctl stop lnd
fi fi
echo "Update Admin Macaroon" echo "Update Admin Macaroon"
sudo rm -r /home/admin/.lnd/data/chain/${network}/${choice}net sudo rm -r /home/admin/.lnd/data/chain/${network}/${choice}net 2>/dev/null
sudo mkdir /home/admin/.lnd/data/chain/${network}/${choice}net sudo mkdir /home/admin/.lnd/data/chain/${network}/${choice}net
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon /home/admin/.lnd/data/chain/${network}/${choice}net sudo cp /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon /home/admin/.lnd/data/chain/${network}/${choice}net
sudo chown -R admin:admin /home/admin/.lnd/ sudo chown -R admin:admin /home/admin/.lnd/