本文介绍了如何从Apple macOS更新包中的“有效载荷"文件中提取内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下命令将MacOS sierra更新软件包-macOSUpd10.12.1.pkg提取到/tmp/macosupd目录.

I am extracting macOS sierra update package - macOSUpd10.12.1.pkg using following command to /tmp/macosupd directory.

pkgutil --expand /Volumes/macOS\ Sierra\ Update/macOSUpd10.12.1.pkg /tmp/macosupd

我可以看到以下软件包捆绑在metapackage中.

I can see following packages are bundled inside the metapackage.

-rwxr-xr-x   1  Distribution
drwxr-xr-x   6  FirmwareUpdate.pkg
drwxr-xr-x   5  FullBundleUpdate.pkg
drwxr-xr-x  36  Resources
drwxr-xr-x   6  macOSUpd10.12.1.pkg

我无法提取有效载荷文件的内容.例如,当我尝试提取macOSUpd10.12.1.pkg的有效载荷时,出现以下错误消息:

I am not able to extract contents of Payload file. For example when i try to extract the Payload of macOSUpd10.12.1.pkg, i get following error message:

含焦油:

tar -xvf macOSUpd10.12.1.pkg/Payload
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

使用xar:

xar -xvf macOSUpd10.12.1.pkg/Payload
Error opening xar archive: macOSUpd10.12.1.pkg/Payload

当我在有效负载文件上运行文件命令时,我收到一条消息,提示:

When I run file command on the payload file, i get a message as:

file macOSUpd10.12.1.pkg/Payload
macOSUpd10.12.1.pkg/Payload: data

通过使用xxd命令查看有效载荷文件的初始位,我可以看到文件类型看起来像pbzx

By seeing initial bits of Payload file using xxd command , i can see file type looks like pbzx

xxd macOSUpd10.12.1.pkg/Payload


00000000: 7062 7a78 0000 0000 0100 0000 0000 0000  pbzx............
00000010: 0100 0000 0000 0000 0031 0330 fd37 7a58  .........1.0.7zX
00000020: 5a00 0000 ff12 d941 04c0 f385 c401 8080  Z......A........
00000030: 8008 2101 1600 0000 506a 84e2 e3b8 13ef  ..!.....Pj......
00000040: fe5d 0018 0ddf 07a4 347c 7c50 9853 8031  .]......4||P.S.1
00000050: 2d14 f703 6903 cf69 f214 76b0 93c0 a4c9  -...i..i..v.....
00000060: 774d 6fb0 8b3a 2257 4a55 04ad 289b cc4d  wMo..:"WJU..(..M
00000070: b835 5db7 7e72 f7a8 dc15 7a9c 7755 800c  .5].~r....z.wU..
00000080: 6060 d45f e078 f84f e537 4319 2d89 f72e  ``._.x.O.7C.-...
00000090: 60c4 cdb0 6b54 9326 9321 3339 4a4f 1e75  `...kT.&.!39JO.u
000000a0: 8eb7 991d 8968 5e6f 45d4 24c9 e364 712b  .....h^oE.$..dq+
000000b0: ef4e 9abc af70 e97a e5a3 1810 7f05 54df  .N...p.z......T.
000000c0: 08d2 3060 9f8a a1e0 edb8 2b10 df23 789d  ..0`......+..#x.
000000d0: 3e52 ee3e d6f0 468a bfee 3366 d39e 28db  >R.>..F...3f..(.

请提出一种有关如何提取Payload文件内容的方法.我已经尝试过 link1 link2 ,包括此外部链接中建议的方法仍然没有成功.似乎小牛之前的苹果更新是纯xar和tar软件包.使用Mavericks及以上版本,Apple将文件格式从tar更改为pbzx(lzma).

Please suggest a way on how to extract the contents of Payload file. I have tried all he methods suggested in link1 and link2, including the method suggested in this external-link still no success. Seems like apple updates prior to Mavericks were pure xar and tar packages. With Mavericks and above apple changed the file format from a tar to pbzx(lzma).

请提出一种简便的命令行方法来提取Payload文件的内容,因为我必须在自动化设置中使用它.

please suggest an easy command line way to extract contents of the Payload file as i have to make use in my automation setup.

推荐答案

pkgutil--expand-full有一个未记录的选项,它使用的语法与pkgutil --expand相同.

There is an undocumented option to pkgutil, --expand-full, which uses the same syntax as pkgutil --expand.

pkgutil --expand-full [pkg] [dir]

这将完全取消存档" pkg或mpkg文件.

This will completely "unarchive" a pkg or mpkg file.

这篇关于如何从Apple macOS更新包中的“有效载荷"文件中提取内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 10:28