Skip to content

Commit 1e3dff8

Browse files
fix: Termux installer stores binary in runtime/ and cleans old PATH entries
Binary is now at ~/.btch/runtime/btch instead of ~/.btch/bin/btch so old PATH entries from previous installs don't shadow the wrapper at $PREFIX/bin/btch (fixes "cannot execute: required file not found"). Also cleans stale .btch/bin PATH lines from shell configs on reinstall. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent 110755f commit 1e3dff8

5 files changed

Lines changed: 46 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
workflow_dispatch:
1111
inputs:
1212
version:
13-
description: "Release tag to publish (for example btch-cli@3.0.14)"
13+
description: "Release tag to publish (for example btch-cli@3.0.15)"
1414
required: true
1515

1616
permissions:
@@ -186,7 +186,7 @@ jobs:
186186
# Publish the package to npm on every GitHub release. Requires the
187187
# NPM_TOKEN secret (Settings → Secrets and variables → Actions) with
188188
# publish permissions. The version is taken from the release tag, so
189-
# just create a release like btch-cli@3.0.14 and the package is
189+
# just create a release like btch-cli@3.0.15 and the package is
190190
# published as 1.0.4 automatically.
191191
npm-publish:
192192
if: github.event_name == 'release'

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.0.15] - 2026-08-22
9+
10+
### Fixed
11+
- Termux: binary now stored in `~/.btch/runtime/` (not `~/.btch/bin/`) so old PATH entries from previous installs don't shadow the wrapper and cause "cannot execute: required file not found"
12+
- Termux: old `~/.btch/bin` PATH entries cleaned from `.bashrc`/`.zshrc`/`.profile` on install
13+
- Termux: wrapper now shows a clear error message if proot-distro Debian fails to start
14+
815
## [3.0.14] - 2026-08-18
916

1017
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ What the installer does:
2626

2727
```bash
2828
# Install a specific version (keep in sync with package.json)
29-
curl -fsSL https://raw.githubusercontent.com/hostinger-bot/btch-cli/main/install.sh | bash -s -- --version 3.0.14
29+
curl -fsSL https://raw.githubusercontent.com/hostinger-bot/btch-cli/main/install.sh | bash -s -- --version 3.0.15
3030

3131
# Install from a local binary instead of downloading
3232
bash install.sh --binary /path/to/btch

install.sh

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Install btch from GitHub Releases.
2121
2222
Usage:
2323
curl -fsSL https://raw.githubusercontent.com/hostinger-bot/btch-cli/main/install.sh | bash
24-
curl -fsSL https://raw.githubusercontent.com/hostinger-bot/btch-cli/main/install.sh | bash -s -- --version 3.0.14
24+
curl -fsSL https://raw.githubusercontent.com/hostinger-bot/btch-cli/main/install.sh | bash -s -- --version 3.0.15
2525
bash install.sh --binary /path/to/btch
2626
2727
Options:
@@ -108,7 +108,7 @@ EOF
108108
}
109109
fi
110110

111-
# Remove leftovers from previous installs (npm route, glibc binary, symlinks).
111+
# Remove leftovers from previous installs (npm route, old binary, wrapper, stale PATH).
112112
rm -f "$HOME/.btch/bin/btch"
113113
rm -f "/usr/local/bin/btch"
114114
if [[ -n "${PREFIX:-}" ]]; then
@@ -117,10 +117,25 @@ EOF
117117
rm -rf "$HOME/.btch"
118118
mkdir -p "$INSTALL_DIR"
119119

120+
# Clean up old PATH entries pointing to ~/.btch/bin from shell config
121+
# files (v3.0.13 and earlier). These would shadow the wrapper at
122+
# $PREFIX/bin/btch and cause the glibc binary to be executed directly
123+
# in Termux, producing "cannot execute: required file not found".
124+
for config in "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.profile" "$HOME/.zshrc" "$HOME/.zshenv"; do
125+
if [[ -f "$config" ]]; then
126+
sed -i "\|.btch/bin|d" "$config" 2>/dev/null || true
127+
sed -i "\|# btch|d" "$config" 2>/dev/null || true
128+
fi
129+
done
130+
120131
# 3) Inside Debian the full glibc + no seccomp means the standalone arm64
121-
# binary works. Resolve the version and download it to Termux home
122-
# (~/.btch/bin) — the wrapper bind-mounts it into Debian at runtime, so
123-
# `btch` runs inside Debian while the CLI stays visible in Termux home.
132+
# binary works. Resolve the version and download to ~/.btch/runtime/ —
133+
# NOT ~/.btch/bin/ (which might be on PATH from old installs and would
134+
# shadow the wrapper). The wrapper bind-mounts the runtime dir into
135+
# Debian at /usr/local/btch.
136+
local RUNTIME_DIR="${USER_DIR}/runtime"
137+
mkdir -p "$RUNTIME_DIR"
138+
124139
ASSET_NAME="btch-linux-arm64"
125140
BINARY_NAME="btch"
126141
resolve_release_version
@@ -135,8 +150,8 @@ EOF
135150
curl -fsSL "${RELEASE_BASE_URL}/checksums.txt" -o "$checksum_file"
136151
verify_checksum "$binary_file" "$checksum_file"
137152

138-
cp "$binary_file" "${INSTALL_DIR}/${BINARY_NAME}"
139-
chmod 755 "${INSTALL_DIR}/${BINARY_NAME}"
153+
cp "$binary_file" "${RUNTIME_DIR}/${BINARY_NAME}"
154+
chmod 755 "${RUNTIME_DIR}/${BINARY_NAME}"
140155
rm -rf "$tmp_dir"
141156

142157
# Best-effort: also copy into the Debian rootfs so `btch` works when
@@ -147,22 +162,27 @@ EOF
147162
chmod 755 "$rootfs/usr/local/bin/${BINARY_NAME}" 2>/dev/null || true
148163
fi
149164

150-
# 4) Wrapper: bind-mount ~/.btch/bin into Debian and run the binary there,
151-
# so `btch` works from Termux even if the rootfs lives elsewhere.
165+
# 4) Wrapper: bind-mount ~/.btch/runtime into Debian and run the binary
166+
# there. The wrapper lives at $PREFIX/bin/btch (already on PATH), so
167+
# typing `btch` finds the wrapper, not the glibc binary.
152168
# `uninstall` is handled here in Termux (the binary runs inside Debian
153169
# with HOME=/root, so it cannot see Termux's install.json).
154170
local wrapper="${PREFIX}/bin/btch"
155171
cat > "$wrapper" <<WRAPPER
156172
#!${PREFIX}/bin/bash
157173
if [[ "\${1:-}" == "uninstall" ]]; then
158-
rm -f "${INSTALL_DIR}/btch"
174+
rm -f "${RUNTIME_DIR}/btch"
159175
rm -f "${wrapper}"
160176
rm -rf "${USER_DIR}"
161177
echo "btch uninstalled."
162178
echo "To also remove the Debian environment, run: proot-distro remove debian"
163179
exit 0
164180
fi
165-
exec proot-distro login --bind "${INSTALL_DIR}:/usr/local/btch" debian -- /usr/local/btch/btch "\$@"
181+
if ! proot-distro login --bind "${RUNTIME_DIR}:/usr/local/btch" debian -- /usr/local/btch/btch "\$@"; then
182+
echo "btch failed to start inside Debian." >&2
183+
echo "Make sure your Debian environment is working: proot-distro login debian" >&2
184+
exit 1
185+
fi
166186
WRAPPER
167187
chmod 755 "$wrapper"
168188

@@ -181,8 +201,8 @@ WRAPPER
181201
"installMethod": "script",
182202
"version": "$(json_escape "$RESOLVED_VERSION")",
183203
"repo": "$(json_escape "$REPO")",
184-
"binaryPath": "$(json_escape "${INSTALL_DIR}/${BINARY_NAME}")",
185-
"installDir": "$(json_escape "$INSTALL_DIR")",
204+
"binaryPath": "$(json_escape "${RUNTIME_DIR}/${BINARY_NAME}")",
205+
"installDir": "$(json_escape "$RUNTIME_DIR")",
186206
"assetName": "$(json_escape "$ASSET_NAME")",
187207
"target": "android-arm64",
188208
"installedAt": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
@@ -199,6 +219,8 @@ METAEOF
199219
echo "Run:"
200220
echo " btch --help"
201221
echo ""
222+
echo "If 'btch' is not found right away, run: hash -r"
223+
echo ""
202224
echo "To uninstall later:"
203225
echo " btch uninstall"
204226
echo " proot-distro remove debian # optional: also remove the Debian environment"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "btch-cli",
3-
"version": "3.0.14",
3+
"version": "3.0.15",
44
"description": "An open-source AI coding agent, built with Bun and OpenTUI.",
55
"type": "module",
66
"main": "dist/index.js",

0 commit comments

Comments
 (0)