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"
    }
}
相关推荐
console.log('npc')1 天前
Windows 11 安装 WSL2 + Ubuntu + Docker + Codex + Sub2API 教学
windows·docker·powershell·ubantu·codex
CV工程师(Ctrl)2 天前
Codex 在 Windows 中文路径执行bash命令编码问题复盘
powershell·codex
vortex55 天前
PowerShell 的命令补全方案: PSReadLine + PSCompletions + argc + Carapace
windows·powershell
深念Y16 天前
踩坑实录:把 Windows 默认 PowerShell 换成 7.x 到底有多坑?一条龙解决指南
windows·乱码·bug·控制台·powershell·管道·流式
IOT那些事儿23 天前
Windows PowerShell配置Qt5编译运行环境
windows·powershell·qt5
今夕资源网1 个月前
powershell工具包 安装升级脚本并设置UTF-8 环境快捷方式创建 将powershell的编码默认改为UTF-8
开发语言·utf-8·powershell·utf-8编码·powershell7·powershell5·设置utf-8编码
fengyehongWorld1 个月前
Powershell 注册.dll类库到系统
powershell
就叫年华吧丶1 个月前
Git Bash、CMD 与 PowerShell 的区别详解
linux·git·命令行·powershell·cmd·gitbash
Soari1 个月前
Ziggo-CaaS-Switch软件配置教程
bash·powershell·tsn 交换机
LAM LAB1 个月前
【shell】win10 Powershell字体美化
powershell