add status to lnd unlock

This commit is contained in:
rootzoll
2021-07-02 23:55:33 +02:00
parent 246ffe46bd
commit 11d17f7d92
2 changed files with 17 additions and 10 deletions

View File

@@ -588,16 +588,10 @@ if [ ${isMounted} -eq 0 ]; then
fi
source ${infoFile}
echo "WAIT LOOP: FINAL SETUP .. see controlFinalDialog.sh" >> $logFile
until [ "${state}" == "ready" ]
do
# TODO: DETECT WHEN USER SETUP IS DONE
echo "TODO: DETECT WHEN USER FINAL DIALOG IS DONE" >> $logFile
# offer option to COPY BLOCKHCAIN (see 50copyHDD.sh)
# handle possible errors
# show seed words
# get latest network info & update raspiblitz.info (in case network changes)
source <(/home/admin/config.scripts/internet.sh status)
sed -i "s/^localip=.*/localip='${localip}'/g" ${infoFile}

View File

@@ -2,7 +2,8 @@
if [ "$1" == "-h" ] || [ "$1" == "help" ]; then
echo "script to unlock LND wallet"
echo "lnd.unlock.sh [?passwordC]"
echo "lnd.unlock.sh status"
echo "lnd.unlock.sh unlock [?passwordC]"
exit 1
fi
@@ -10,13 +11,25 @@ fi
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# 1. parameter
passwordC="$1"
# 1. parameter (default is unlock)
action="$1"
# 2. parameter (optional password)
passwordC="$2"
# check if wallet is already unlocked
echo "# checking LND wallet ... (can take some time)"
walletLocked=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>&1 | grep -c unlock)
macaroonsMissing=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>&1 | grep -c "unable to read macaroon")
# if action sis just status
if [ "${action}" == "status" ]; then
echo "locked=${walletLocked}"
echo "missingMacaroons=${macaroonsMissing}"
exit 0
fi
# if already unlocked all is done
if [ ${walletLocked} -eq 0 ] && [ ${macaroonsMissing} -eq 0 ]; then
echo "# OK LND wallet was already unlocked"
exit 0