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"
    }
}
相关推荐
IOT那些事儿2 天前
Windows PowerShell配置Qt5编译运行环境
windows·powershell·qt5
今夕资源网5 天前
powershell工具包 安装升级脚本并设置UTF-8 环境快捷方式创建 将powershell的编码默认改为UTF-8
开发语言·utf-8·powershell·utf-8编码·powershell7·powershell5·设置utf-8编码
fengyehongWorld10 天前
Powershell 注册.dll类库到系统
powershell
就叫年华吧丶10 天前
Git Bash、CMD 与 PowerShell 的区别详解
linux·git·命令行·powershell·cmd·gitbash
Soari15 天前
Ziggo-CaaS-Switch软件配置教程
bash·powershell·tsn 交换机
LAM LAB22 天前
【shell】win10 Powershell字体美化
powershell
humors22124 天前
AI工具合集,不定期更新
人工智能·windows·ai·工具·powershell·deepseek
fengyehongWorld1 个月前
Powershell 自动安装Excel自定义标签页,开启宏
powershell
西西弗Sisyphus1 个月前
PowerShell 配置为启动时自动激活 Conda 环境
conda·powershell
夫唯不争,故无尤也2 个月前
curl与Invoke-RestMethod核心区别
后端·fastapi·powershell·curl