scoop bucket qq脚本分析(qq绿色安装包制作)

url字段

以qq.json为例,其对应的scoop配置文件在$env:scoop\buckets\extras\bucket\qq.json

其中的url字段

bash 复制代码
"url":"https://webcdn.m.qq.com/spcmgr/download/QQ9.7.17.29230.exe#/dl.7z"

为qq安装包下载地址,后缀#/dl.7z为自行添加,表明该安装包的解压方式使用7z,解压命令7z.exe x qq.exe -o,解压默认目录为$env:scoop/apps/qq/9.7.17.29230/

QQ9.7.17.29230.exe安装包内容解构及其绿色化

解压之后调用"installer"字段,其中的执行步骤如下:

  1. 删除.rsrc目录之外的所有文件
  2. 使用7z解压其中的$dir\.rsrc\2052\MSI\101\Files到当前目录。Files中包含bin\qq.exe等重要可执行文件。
  3. 使用7z解压其中的$dir\.rsrc\2052\MSI\102到临时目录,其中有重要的系统级别动态库dll
  4. 拷贝上一步中的动态库dll到bin目录中,以便qq.exe寻找到库。
  5. 使用7z解压其中的TXSSOSetup.exe,该程序用于网页的qq快速登陆
  6. 清理当前目录

附qq.json内容如下

json 复制代码
{
    "version": "9.7.17.29230",
    "description": "An instant messaging tool that gives you the best way to keep in touch with your friends and family.",
    "homepage": "https://im.qq.com",
    "license": {
        "identifier": "Proprietary",
        "url": "https://ti.qq.com/agreement/index.html"
    },
    "notes": [
        "Scoop doesn't persist your QQ data, by default they are stored in: ",
        "'%UserProfile%\\Documents\\Tencent Files'.",
        "Files produced at runtime leaves in '%AppData%\\Tencent'."
    ],
    "url": "https://webcdn.m.qq.com/spcmgr/download/QQ9.7.17.29230.exe#/dl.7z",
    "hash": "5ae1949f7ba4c65bf82ee53c55053ad91cb524150a93bf1d2035e530c54757c9",
    "shortcuts": [
        [
            "Bin\\QQScLauncher.exe",
            "QQ"
        ]
    ],
    "installer": {
        "script": [
            "Get-Item \"$dir\\*\" -Exclude .rsrc | Remove-Item",
            "Expand-7zipArchive \"$dir\\.rsrc\\2052\\MSI\\101\" \"$dir\" -ExtractDir 'Files'",
            "Expand-7zipArchive \"$dir\\.rsrc\\2052\\MSI\\102\" \"$dir\\temp\"",
            "'vcruntime140.dll', 'msvcp140.dll', 'msvcr100.dll', 'vcomp140.dll', 'msvcp100.dll' | ForEach-Object {",
            "  Move-Item \"$dir\\temp\\$_\" \"$dir\\Bin\\\"",
            "}",
            "Expand-7zipArchive \"$dir\\temp\\TXSSO\\TXSSOSetup.exe\" \"$dir\\Bin\\TXSSO\" -ExtractDir 'TXSSO'",
            "Remove-Item \"$dir\\.rsrc\", \"$dir\\temp\" -Recurse"
        ]
    },
    "checkver": {
        "url": "https://pc.qq.com/detail/2/detail_2.html",
        "regex": "QQ([\\d.]+).exe"
    },
    "autoupdate": {
        "url": "https://webcdn.m.qq.com/spcmgr/download/QQ$version.exe#/dl.7z"
    }
}
相关推荐
love530love4 天前
Scoop 完整迁移指南:从 C 盘到 D 盘的无缝切换
java·服务器·前端·人工智能·windows·scoop
笨笨D幸福4 天前
应用程序重定向技术(Shim)
bash·scoop·shim
love530love5 天前
Windows 多 Git 环境冲突:一个环境变量优先级引发的血案
人工智能·windows·git·环境变量·scoop
Moshow郑锴11 天前
WindowsRemoteAdmin(超级马里奥像素版)专为无远程登录桌面系统打造的便携式管理工具
java·powershell·远程控制·远程桌面·系统运维
超级大福宝1 个月前
PowerShell 实现类似 Bash 的补全行为
bash·powershell
小雪_Snow1 个月前
PowerShell 版本升级教程
powershell
Whoami!1 个月前
⓫⁄₅ ⟦ OSCP ⬖ 研记 ⟧ Windows权限提升 ➱ 利用PowerShell获取敏感信息
网络安全·信息安全·powershell·windows日志
小雪_Snow1 个月前
PowerShell 修改编码为 UTF-8 教程
powershell
番茄灭世神1 个月前
常见终端工具输出中文乱码的解决方案
bash·编码格式·powershell·终端工具
chao_6666662 个月前
解决 PowerShell 中文乱码问题
网络·学习·powershell