Mac解pkg软件包

发布时间 2023-08-28 16:30:09作者: 自在拉基

举例pkg包名Patcher.pkg

  1. 解压包
# 将Patcher.pkg 文件解压到 pd目录下
xar -xf Patcher.pkg -C pd
  1. 查看目录架构
╰─ tree                                                                      ─╯
.
├── Distribution
├── Resources
│   └── background.png
└── pd_patcher.pkg
    ├── Bom
    ├── PackageInfo
    ├── Payload
    └── Scripts
  1. 解压安装中的脚本调用
cd pd_patcher.pkg
cat Scripts | cpio -i     
tree                                                                      ─╯
.
├── Bom
├── PackageInfo
├── Payload
├── Scripts
├── postinstall
└── preinstall
# postinstall  与     preinstall 是安装中使用到的脚本。打开查看就不是乱码了。                                      

brew install pbzx
pbzx -n Payload | cpio -i
tree                                                                                                                                                 ─╯
.
├── Applications
│   └── Parallels Desktop.app
│       └── Contents
│           └── MacOS
│               ├── launch_helper.sh
│               └── launcher.sh
├── Bom
├── Library
│   └── Preferences
│       └── Parallels
│           └── licenses.json
├── PackageInfo
├── Payload
├── Scripts
├── postinstall
└── preinstall
# Applications 与 Library 是Payload解压出来的文件
  1. 结束

以上操作就已结束pkg的文件解压了,你可以看到安装时的脚本调用,还有资源文件。如何打包pkg下次再说。

参考链接:https://www.oomake.com/question/12574660