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"
    }
}
相关推荐
JUNIOR_MU1 天前
【VMware VCF】使用 PowerVCF 连接和管理 VMware Cloud Foundation 环境。
powershell·vcf·vmware cloud foundation·powercli·powervcf·power validated solutions·request-vcftoken
豆小匠Coding5 天前
Windows安装Vim,并在PowerShell中直接使用vim
linux·编辑器·vim·powershell
小Tomkk25 天前
PowerShell 脚本编写 :自动化Windows 开发工作流程
数据库·windows·powershell
xuchaoxin13751 个月前
windows@命令行安装国内软件@scoop和winget安装国内软件
windows·cli·scoop
svygh1231 个月前
powershell自动提交git脚本
git·自动化·办公自动化·powershell·自动化脚本
x-cmd1 个月前
x-cmd mod | x scoop - Windows 开源包管理工具
windows·开源·软件安装·命令行·powershell·包管理·winget
Ustinian_3101 个月前
【PowerShell】巧用 Windows PowerShell 实现自动化
运维·windows·自动化·powershell
HaiJaine2 个月前
告别痕迹:远程桌面连接历史和凭据的清零指南
powershell·rdp·安全隐私保护·技术教程·windows远程桌面·记录与凭据删除
__Witheart__2 个月前
【教程】在 VS Code 集成终端中解决 Node.js 环境变量识别问题
ide·vscode·node.js·powershell·terminal
我重来不说话2 个月前
使用 PowerShell 自动化图像识别与鼠标操作
自动化·powershell·自动化脚本