- Startseite
- Plugins
- Entwicklung & Plugin-Tools
- dsh-termux-bootstrap
dsh-termux-bootstrap
shuimu1hao/dsh-termux-bootstrap
One-shot Termux repair for DSH: rebuilds the Android flock binding, patches the boot entry and the dsh launcher, installs pnpm when missing, then automatically installs the companion dsh-termux-shell plugin (termux_bash plus the session-log hard-link fallback) and disables itself.
Installation
dsh plugin --profile web add github:shuimu1hao/dsh-termux-bootstrapREADME
dshtermux 环境配置问题解决
包名 / 仓库名:
dsh-termux-bootstrap(npm 与 GitHub 名称只能是 ASCII;插件页面显示名就是「dshtermux环境配置问题解决」)。
DeepSeek Harness(dsh)在 Android / Termux 上的一次性引导插件:安装后自动修复 Android 原生补丁、自动装好 Termux 终端插件(dsh-termux-shell,提供 termux_bash 与会话日志兜底),完成后自动关闭自己。
兼容性只在实测机型上验证过(vivo X200 + Android 16 + Termux,dsh 0.2.2-rc.5)。换机后请以
~/.dsh/termux-bootstrap/<profile>/report.md的检查结果为准,不要假定全部可用。
为什么需要它
在 Termux 上 npm install dsh 之后,通常还差几件事才能稳定使用:
| 问题 | 后果 | 本插件怎么处理 |
|---|---|---|
node-addon-system 的 flock 只认 linux/darwin | 会话写入时报 flock is not supported on android-arm64 | 用 clang 编译 android 绑定,并放开平台判断 |
node-addon-require-builtin 没有 android 包 | 启动即 No usable native binding ... | 把 dsh-app-boot 的两个入口改成 createRequire 内部模块 |
$PREFIX/bin/dsh 需要 --expose-internals | 缺少时启动失败 | 按当前安装目录重写启动器 |
Android 拒绝 link(2) | 每个新会话首条消息 EACCES ... session.v4.jsonl.zstd | 自动安装 dsh-termux-shell(rename 兜底) |
内置 bash 无沙箱后端 | 沙箱预设下 SANDBOX_UNAVAILABLE | 自动安装 dsh-termux-shell(termux_bash) |
| 缺 pnpm / 存储放错位置 | 装插件失败 | 自动 npm install -g pnpm,并检查是否在共享存储 |
附带安装的插件(重要)
本插件跑完环境修复后,会自动把同作者的另一个插件 dsh-termux-shell(Termux 终端)安装并启用,因为 Termux 上还有两个问题只能由它解决:
- 仓库:https://github.com/shuimu1hao/dsh-termux-shell
- 它注册
termux_bash工具:Android 没有可用的文件沙箱后端,内置bash在read-only/workspace-write预设下必然报SANDBOX_UNAVAILABLE; - 它注入
sessionPersistence兜底:Android 拒绝link(2),把会话日志首次落盘的硬链接改为 rename,解决每条新会话首条消息的EACCES: permission denied, link ...session.v4.jsonl.zstd; - 安装方式与手动
dsh plugin --profile web add <目录>完全一致:写入当前 profile 的dependencies与dsh.profile.bundles,不会碰 dsh 本体; - 顺序是「先修复环境 → 再装终端插件 → 最后关闭本插件」。已经装过且启用时只做校验。
如果你不需要它:
- 把本插件配置里的
installTerminalPlugin设为false,完全跳过安装; - 或者装完后单独移除:
dsh plugin --profile web remove dsh-termux-shell。
执行流程
- 检查 Node.js、pnpm、存储位置;
- 修复 flock 绑定、flock 平台判断、dsh-app-boot 入口、
$PREFIX/bin/dsh启动器; - 通过 profile 的
pluginManager安装并启用dsh-termux-shell(本地源码优先,缺失时从 GitHub tarball 下载到~/dsh-plugins/); - 把结果写到
~/.dsh/termux-bootstrap/<profile>/report.md,然后通过pluginManager把本插件的行设为disabled: true。
全部步骤幂等;已经修好的项只报 ok。可读状态在 ~/.dsh/termux-bootstrap/<profile>/state.json。
安装
dsh plugin --profile web add "$HOME/dsh-plugins/dsh-termux-bootstrap"
或在 Web 的 Plugins → Add plugin 填绝对路径(~ 要展开成绝对路径)。网络能连 GitHub 时也可以直接:
dsh plugin --profile web add https://github.com/shuimu1hao/dsh-termux-bootstrap
插件声明了 dsh.bundle,安装后自动加入该 profile 的 bundles。市场收录后也可以在 Plugins → Plugin Market 里搜索 dsh-termux-bootstrap 一键安装。
安装/重启后约 3 秒开始执行(不阻塞 dsh 启动)。完成后:
- Plugins 里
dsh-termux-bootstrap这一行变成已禁用; dsh-termux-shell出现并处于启用状态,新会话可调用termux_bash。
查看结果
cat ~/.dsh/termux-bootstrap/${DSH_PROFILE:-web}/report.md
cat ~/.dsh/termux-bootstrap/${DSH_PROFILE:-web}/state.json
报告位于 ~/.dsh/termux-bootstrap/<profile>/report.md;✅ ok / 🔧 fixed / ⚠️ warning / ❌ failed / ➖ skipped 分别表示已正常、已修复、需留意、失败、跳过。
配置
在 profile 的 cordis.patch.yml 里按行 id 覆盖(config 是整体替换,只写要改的字段时其余字段回落到默认值):
- id: termux-bootstrap
config:
rerun: true
| 字段 | 默认值 | 说明 |
|---|---|---|
enabled | true | 启动时执行 |
rerun | false | 已经完成过也再执行一次(用于重试) |
delayMs | 3000 | 插件挂载后延迟多久开始 |
dshAppDir | ""(=$HOME/dsh-app) | dsh-app 安装目录 |
installTerminalPlugin | true | 安装并启用终端插件 |
terminalBundle | dsh-termux-shell | 终端插件包名 |
terminalSourceDir | ""(=$HOME/dsh-plugins/dsh-termux-shell) | 终端插件本地源码目录 |
downloadSources | 三个 GitHub tarball 地址 | 本地源码缺失时按顺序尝试 |
repairNativeModules | false | 缺少 node-pty 产物时执行 npm rebuild(会重写正在使用的文件,建议先停 dsh) |
disableWhenDone | true | 完成后自动关闭本插件 |
maxAttempts | 3 | 连续失败多少次后不再自动重试 |
commandTimeoutMs | 600000 | 单条子命令超时 |
重新执行
完成后 profile 的 cordis.patch.yml 里会多出一条 - id: termux-bootstrap + disabled: true。把这一条替换成:
- id: termux-bootstrap
config:
rerun: true
然后重启 dsh(或在 Plugins 页面重新启用该行)。rerun: true 会让插件忽略“已完成”记录,再走一遍全部步骤,结束后再次自动关闭。
局限与安全
- 需要 dsh 已经能启动:本插件运行在 dsh 进程里,修复不了“dsh 根本起不来”的情况;那种情况按操作手册先执行
cd ~/dsh-app && node termux-patch.mjs。 - 只按
$HOME/dsh-app这一种安装布局工作;用全局 npm 安装或自定义目录时,通过dshAppDir指定,启动器只在“当前进程确实从该目录启动”时才会被改写。 - 默认不联网。只有本地没有终端插件源码时才下载,且只写入
~/dsh-plugins/;下载内容会校验package.json的包名。 - 不读取、不记录任何 token;报告在
~/.dsh/termux-bootstrap/<profile>/report.md,其中只有路径、版本与命令输出摘要。 - 修改 profile 的唯一途径是
pluginManager服务(与dsh plugin add/ Plugins 页面同一条路径),不会手改package.json。
卸载
dsh plugin --profile web remove dsh-termux-bootstrap
完成后本插件已自行禁用,直接卸载不会影响 dsh-termux-shell。
Ähnliche Plugins
deepseek-harness
deepseek-ai/deepseek-harness
dsh-market
dsh-market/dsh-market
dsh-web (dsh-plugin-manager)
zhu1090093659/dsh-web
dsh-web
zhu1090093659/dsh-web