monitoring: find user-local wallet-cli
This commit is contained in:
parent
cd3cb1c054
commit
b9d37f6729
2 changed files with 23 additions and 2 deletions
|
|
@ -288,7 +288,7 @@ BANK_HOST=$(python3 -c 'from urllib.parse import urlparse; print(urlparse("'"$BA
|
||||||
|
|
||||||
SCRATCH=$(mktemp -d)
|
SCRATCH=$(mktemp -d)
|
||||||
WDB="$SCRATCH/wallet.sqlite3"
|
WDB="$SCRATCH/wallet.sqlite3"
|
||||||
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
export PATH="${HOME}/.local/bin:${HOME}/taler/opt/taler-wallet-cli/usr/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||||
# Always dump balances on any exit (timeout, blocker, signal, success)
|
# Always dump balances on any exit (timeout, blocker, signal, success)
|
||||||
trap 'ec=$?; e2e_finish "$ec"; rm -rf "$SCRATCH"; exit "$ec"' EXIT
|
trap 'ec=$?; e2e_finish "$ec"; rm -rf "$SCRATCH"; exit "$ec"' EXIT
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -599,14 +599,35 @@ read_secret() {
|
||||||
}
|
}
|
||||||
|
|
||||||
find_wallet_cli() {
|
find_wallet_cli() {
|
||||||
|
# Must return a path suitable for: node "$WALLET_CLI" …
|
||||||
|
# Prefer *.mjs / bundled entry; plain /usr/bin/taler-wallet-cli is often a
|
||||||
|
# shell wrapper and cannot be passed to node.
|
||||||
if [ -n "${WALLET_CLI:-}" ] && [ -f "$WALLET_CLI" ]; then
|
if [ -n "${WALLET_CLI:-}" ] && [ -f "$WALLET_CLI" ]; then
|
||||||
echo "$WALLET_CLI"; return 0
|
echo "$WALLET_CLI"; return 0
|
||||||
fi
|
fi
|
||||||
|
local c cand
|
||||||
for c in \
|
for c in \
|
||||||
|
"${HOME}/.local/bin/taler-wallet-cli.mjs" \
|
||||||
|
"${HOME}/taler/opt/taler-wallet-cli/usr/lib/taler-wallet-cli/node_modules/taler-wallet-cli/bin/taler-wallet-cli.mjs" \
|
||||||
|
/home/hernani/taler/opt/taler-wallet-cli/usr/lib/taler-wallet-cli/node_modules/taler-wallet-cli/bin/taler-wallet-cli.mjs \
|
||||||
/Users/newkamek/src/taler/taler-typescript-core/packages/taler-wallet-cli/bin/taler-wallet-cli.mjs \
|
/Users/newkamek/src/taler/taler-typescript-core/packages/taler-wallet-cli/bin/taler-wallet-cli.mjs \
|
||||||
"$(command -v taler-wallet-cli 2>/dev/null || true)"
|
/usr/lib/taler-wallet-cli/node_modules/taler-wallet-cli/bin/taler-wallet-cli.mjs \
|
||||||
|
/usr/share/taler-wallet-cli/bin/taler-wallet-cli.mjs
|
||||||
do
|
do
|
||||||
[ -n "$c" ] && [ -f "$c" ] && { echo "$c"; return 0; }
|
[ -n "$c" ] && [ -f "$c" ] && { echo "$c"; return 0; }
|
||||||
done
|
done
|
||||||
|
# Debian package wrapper → resolve real .mjs
|
||||||
|
cand=$(command -v taler-wallet-cli 2>/dev/null || true)
|
||||||
|
if [ -n "$cand" ] && [ -f "$cand" ]; then
|
||||||
|
if head -1 "$cand" 2>/dev/null | grep -q 'node\|mjs'; then
|
||||||
|
# shebang node script or .mjs
|
||||||
|
echo "$cand"; return 0
|
||||||
|
fi
|
||||||
|
# follow symlink into package tree
|
||||||
|
if [ -L "$cand" ]; then
|
||||||
|
c=$(readlink -f "$cand" 2>/dev/null || true)
|
||||||
|
[ -n "$c" ] && [ -f "$c" ] && { echo "$c"; return 0; }
|
||||||
|
fi
|
||||||
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue