From 9abd5ecf45b43155f5da4e9819a5a760f86dec4c Mon Sep 17 00:00:00 2001 From: Lagrang3 Date: Sat, 30 Dec 2023 21:51:17 +0100 Subject: [PATCH] regtest: error message if bitcoin-cli is not found If $BITCOIN_BIN is empty and bitcoin-cli or bitcoind are not found startup_regtest will shutdown and display a corresponding error message. Similarly if lightning-cli and lightningd are not found. --- contrib/startup_regtest.sh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/contrib/startup_regtest.sh b/contrib/startup_regtest.sh index 198210205..e283fca02 100755 --- a/contrib/startup_regtest.sh +++ b/contrib/startup_regtest.sh @@ -31,10 +31,10 @@ # We've got a legacy problem is that PATH_TO_LIGHTNING is the # path to the lightningd / lightning-cli and PATH_TO_BITCOIN # is the path to the bitcoin data dir. These are not the same -# things (data directories vs binary locations). +# things (data directories vs binary locations). # Ideally we'd let users set each of these four # things independently. Unless we rename stuff, this going to -# be problematic. +# be problematic. # # Instead we rename them and throw up # if you're using the old ones. @@ -56,10 +56,14 @@ fi if [ -z "$LIGHTNING_BIN" ]; then # Already installed maybe? Prints - # shellcheck disable=SC2039 - type lightning-cli >/dev/null 2>&1 || return - # shellcheck disable=SC2039 - type lightningd >/dev/null 2>&1 || return + if [ ! "$(type lightning-cli >/dev/null 2>&1)" ]; then + echo lightning-cli: not found + return 1 + fi + if [ ! "$(type lightningd >/dev/null 2>&1)" ]; then + echo lightningd: not found + return 1 + fi LCLI=lightning-cli LIGHTNINGD=lightningd else @@ -89,10 +93,14 @@ fi # shellcheck disable=SC2153 if [ -z "$BITCOIN_BIN" ]; then # Already installed maybe? Prints - # shellcheck disable=SC2039 - type bitcoin-cli >/dev/null 2>&1 || return - # shellcheck disable=SC2039 - type bitcoind >/dev/null 2>&1 || return + if [ ! "$(type bitcoin-cli >/dev/null 2>&1)" ]; then + echo bitcoin-cli: not found + return 1 + fi + if [ ! "$(type bitcoind >/dev/null 2>&1)" ]; then + echo bitcoind: not found + return 1 + fi BCLI=bitcoin-cli BITCOIND=bitcoind else