From 11d17f7d9283314c77854c782d06b7399a8aa79b Mon Sep 17 00:00:00 2001 From: rootzoll Date: Fri, 2 Jul 2021 23:55:33 +0200 Subject: [PATCH] add status to lnd unlock --- home.admin/_bootstrap.sh | 8 +------- home.admin/config.scripts/lnd.unlock.sh | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index 9c96949b6..a85bde193 100755 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -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} diff --git a/home.admin/config.scripts/lnd.unlock.sh b/home.admin/config.scripts/lnd.unlock.sh index d781e10e3..c83030d33 100755 --- a/home.admin/config.scripts/lnd.unlock.sh +++ b/home.admin/config.scripts/lnd.unlock.sh @@ -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