我使用 productbuild 实用程序创建了一个 pkg 文件,我想查看其内容。我该怎么做?
我在 MacOS 10.9.5 下。
最佳答案
您可以使用 pkgutil 将您的包解压缩到临时目录中.
pkgutil --expand pkg-path dir-path
Expand the flat package at pkg-path into a new directory specified by dir-path.
还有一个非常好的第三方工具叫做 Pacifist ,由 CharlesSoft 提供。无需解压即可查看包内容。
更新
在 pkg
存档(这是一个 xar
存档)中,您可能会遇到以下文件:
- Bom:Mac OS X Material list (BOM) 文件
The Mac OS X Installer uses a file system "bill of materials" to determine which files to install, remove, or upgrade. A bill of materials, bom, contains all the files within a directory, along with some information about each file. File information includes: the file's UNIX permissions, its owner and group, its size, its time of last modification, and so on. Also included are a checksum of each file and information about hard links. [man bom]
您可以使用lsbom 列出bom
文件的内容命令。并使用 mkbom 创建文件.
- PackageInfo:XML文档文本
此 xml
文件包含有关程序包的一般信息。
- Payload:gzip 压缩数据,来自 Unix
这是一个 gzip 压缩的 cpio
存档。您可以使用 tar
命令将其内容提取到当前目录:
$ tar -xf Payload
或者解压到指定目录dir-path
:
$ tar -C dir-path -xf Payload
您可以选择只列出 Payload
存档的内容:
$ tar -tf Payload
您应该能够使用以下方法从 dir-path
重新创建存档:
$ tar --format cpio -czf Payload dir-path
关于macos - 查看使用 productbuild 创建的包内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29941273/