essay | tech | year-summary | about
日期:2026-02-17T00:54:33+08:00
scoop version:v0.5.3
当使用scoop install的时候,有这样一行提示文字
To install a different version of the app
(note that this will auto-generate the manifest using current version):
scoop install [email protected]
如果 scoop install [email protected] 会怎样?
(1)会锁死,scoop update gh 无法升级。
使用 scoop unhold gh 无法解锁,因为根本就没有锁。
那么scoop是如何做到的?
查阅scoop的代码,一看全特么PowerShell script,叫GPT5.3 codex帮忙找了一下代码位置。发现是这样的操作。
(1)scoop会在 %userprofile%\scoop\workspace 创建一个gh.json
这就是文档中说的manifest file
(2)scoop会在 %userprofile%\scoop\apps\gh\current 中,install.json会变成这样
{
"url": "<%userprofile%>\\scoop\\buckets\\main\\bucket\\gh.json",
"architecture": "64bit"
}
而正常的install.json是这样的
{
"bucket": "main",
"architecture": "64bit"
}
那么恢复就是
(1)删掉%userprofile%\scoop\workspace\gh.json
(2)把%userprofile%\scoop\apps\gh\current\install.json 的 url 改成 bucket
(3)如果比如你安装的是Firefox,它自动升级了,current不是symbol link,而是实体文件,那么要还原scoop的文件夹结构,把current变成symbol link
大功告成。
感谢ChatGPT 5.3 codex,不然我读苦手的PowerShell script要了老命了。