emrg: fix macOS pkg user-level install — --install-location + currentUserHome domain - #409
Conversation
…UserHome domain (rant 2026-08-05T18:45:35) 双 bug 修复: 1. pkgbuild 未指定 --install-location → 默认装系统宗卷 / → '软件包正尝试将内容安装到系统宗卷' 报错 2. postinstall 复制源 /tmp/emrg-payload 为构建机路径,打包后立即删除 → 用户安装空复制 改法:payload 去掉 runtime/ 层,pkgbuild --install-location '/.emrg/install' + productbuild distribution currentUserHome 域(enable_localSystem=false) → 引擎直接装 ~/.emrg/install/,postinstall 只做 chown + GUI 复制到 ~/Applications/ 本机实测:pkgbuild+productbuild 构建成功,installer -pkg 安装到 ~/ .emrg/install(emrg 可运行)+ ~/Applications/EMRG.app + 卸载 EMRG.app
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
已 review diff:payload 去 runtime/ 层 + pkgbuild --install-location '/.emrg/install' + productbuild currentUserHome 域(enable_localSystem=false)+ postinstall 用 $2 替代 /tmp 假想路径,双 bug 修复逻辑正确。本机 macOS arm64 实测 installer -pkg 安装成功(~/.emrg/install/bin/emrg 可运行 + ~/Applications/EMRG.app 就位),CI test 通过。
rant 2026-08-05T18:45:35 验收项:安装后 emrg 命令可用(pkg postinstall 写 shell rc anchor R19)。Windows 有 HKCU PATH、Linux AppImage 有 ~/.local/bin 软链,唯 macOS 缺 —— 本 commit 补上: - postinstall 写 shell rc PATH anchor(# >>> EMRG PATH >>> 标记),格式与 bin/emrg-uninstall clean_environment() 完全一致(卸载对称清理) - 幂等:任一 rc 已含 anchor 则跳过;写所有存在的 rc(zsh 默认 + bash 兼容), 无 rc 兜底创建 ~/.zshrc(macOS 默认 zsh) - 验证:临时 HOME 实测安装写入 anchor、重复安装不重复写、 clean_environment regex 可完整匹配清理;470 pytest 全绿
|
补充 commit f0cae96:postinstall 增加 shell rc PATH anchor(R127/R19)——macOS 安装后 emrg 命令直接可用(Windows 有 HKCU PATH、Linux 有 ~/.local/bin 软链,macOS 此前缺失)。anchor 标记与 emrg-uninstall 的 clean_environment() 对称(卸载自动清理),幂等写入。 验证:临时 HOME 实测写入 ~/.zshrc、重复安装不重复、卸载 regex 完整匹配;470 pytest 全绿。 |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
第 3 个不同 cycle 的 LGTM。代码已在 cycle-185422(本机安装实测)与 cycle-190805(PATH anchor 注入实测)分别验证,diff 无变化,CI test 通过。满足合并条件(连续 3 cycle ✅ 无 ❌),执行 merge。
rant 2026-08-05T18:45:35 验收项:v0.2.4(或下个版本)macos-arm64.pkg 双击安装 无系统卷报错。master 已合入 #409(--install-location + currentUserHome 域 + postinstall PATH anchor),本次 bump 0.2.3 → 0.2.4 并推 tag 触发发布链: - #409 macOS pkg 用户级安装双 bug 修复(系统宗卷 + /tmp 假想路径) - #409 补充:postinstall shell rc PATH anchor(R127/R19) 版本文件 6 处同步:pyproject.toml / __init__.py / uv.lock / make-installer.sh / build-runtime.sh / gui package.json Co-authored-by: argszero <argszero@argszerodeMac-mini.local>
背景
rant 2026-08-05T18:45:35:v0.2.3 macOS arm64 pkg 双击/命令行安装均报「软件包正尝试将内容安装到系统宗卷」。
根因(双重 bug)
pkgbuild未指定--install-location→ 默认安装位置为系统宗卷/→ 用户级安装被 macOS 拒绝/tmp/emrg-payload是构建机路径:构建时创建、打包后立即rm -rf→ 用户机安装时空复制(无 set -e,cp 失败仍 exit 0)修复
runtime/嵌套层,直接放 runtime 内容pkgbuild --install-location '/.emrg/install'(currentUserHome 域下相对 home 锚点)productbuild --distribution配<domains enable_currentUserHome="true" enable_localSystem="false"/>→ 安装器显示「仅当前用户」,无需系统卷权限$2(安装器传入真实位置)替代 /tmp 假想路径,仅做 chown(R105)+ GUI 复制到 ~/Applications/(R104),保留 R67 控制台用户 HOME 检测验证(本机 macOS arm64 实测)
install-location="/.emrg/install"+ currentUserHome 域确认installer -pkg ... -target CurrentUserHomeDirectory安装成功("Installing at base path /Users/argszero")~/.emrg/install/bin/emrg可运行;~/Applications/EMRG.app+卸载 EMRG.app均就位emrg --helpOK