diff --git a/scripts/bitcoin-ln-node/get-lnbits-key.sh b/scripts/bitcoin-ln-node/get-lnbits-key.sh index e8306a8..60e2195 100755 --- a/scripts/bitcoin-ln-node/get-lnbits-key.sh +++ b/scripts/bitcoin-ln-node/get-lnbits-key.sh @@ -24,8 +24,32 @@ die() { echo -e "${RED}[error]${NC} $*" >&2; exit 1; } # ─── Helpers ───────────────────────────────────────────────────────────────── -# Return 0 (true) if $1 >= $2 (semantic version comparison) -version_gte() { printf '%s\n%s\n' "$2" "$1" | sort -V -C; } +# Return 0 (true) if $1 >= $2 (semver comparison, macOS/BSD-safe) +# Uses python3 when available (already required for JSON parsing elsewhere), +# otherwise falls back to pure-bash numeric major.minor.patch comparison. +version_gte() { + local v1="$1" v2="$2" + if command -v python3 &>/dev/null; then + python3 - "$v1" "$v2" <<'PYEOF' +import sys +def parse(v): + parts = v.strip().split(".") + return [int(x) for x in (parts + ["0","0","0"])[:3]] +sys.exit(0 if parse(sys.argv[1]) >= parse(sys.argv[2]) else 1) +PYEOF + else + # Pure-bash fallback: split on dots, compare numerically + local IFS=. + # shellcheck disable=SC2206 + local a=($v1) b=($v2) + for i in 0 1 2; do + local av="${a[$i]:-0}" bv="${b[$i]:-0}" + if (( av > bv )); then return 0; fi + if (( av < bv )); then return 1; fi + done + return 0 # equal + fi +} # Print the export template the operator needs to paste into Replit Secrets print_export_template() { diff --git a/scripts/bitcoin-ln-node/setup.sh b/scripts/bitcoin-ln-node/setup.sh index 45f0470..0e3070c 100755 --- a/scripts/bitcoin-ln-node/setup.sh +++ b/scripts/bitcoin-ln-node/setup.sh @@ -328,6 +328,11 @@ echo " 1. Create your LND wallet: lncli --lnddir=$LND_DIR create" echo " 2. Check sync status: bash $SCRIPT_DIR/status.sh" echo " 3. Once synced, get key: bash $SCRIPT_DIR/get-lnbits-key.sh" echo "" +echo " LNbits key retrieval (get-lnbits-key.sh):" +echo " • LNbits < 0.12 — auto-creates a wallet via the superuser API" +echo " • LNbits >= 0.12 — superuser API removed; script walks you through" +echo " the Admin UI at http://localhost:5000/admin" +echo "" echo " Secrets are in: $SECRETS_FILE" echo " Logs are in: $LOG_DIR/" echo ""