diff --git a/install-pi.sh b/install-pi.sh index da80d37..a2b0d88 100755 --- a/install-pi.sh +++ b/install-pi.sh @@ -104,9 +104,11 @@ if command -v pi &>/dev/null; then PI_BIN="$(command -v pi)" fi -# 2) Try expanding common locations where npm/pip install globally +# 2) Try expanding common locations where npm/pip/curl-installer place the binary +# pi-node uses versioned dirs like node-v22.22.2-linux-x64, so we glob for any subdir if [ -z "$PI_BIN" ]; then for candidate in \ + "$HOME/.local/share/pi-node/current/bin/pi" \ "$HOME/.local/bin/pi" \ "$HOME/.npm/bin/pi" \ "/usr/local/bin/pi" \ @@ -117,6 +119,17 @@ if [ -z "$PI_BIN" ]; then break fi done + + # Glob for pi-node versioned installs (e.g. ~/.local/share/pi-node/node-v22.22.2-linux-x64/bin/pi) + if [ -z "$PI_BIN" ]; then + _latest_pi_node="$HOME/.local/share/pi-node" + if [ -d "$_latest_pi_node" ]; then + _pi_node_bin="$(find "$_latest_pi_node" -name pi -path '*/bin/pi' -type f 2>/dev/null | head -1)" + if [ -n "$_pi_node_bin" ] && [ -x "$_pi_node_bin" ]; then + PI_BIN="$_pi_node_bin" + fi + fi + fi fi # 3) Try npm prefix to locate the global bin