有人真正使用 PackageMaker 来创建 MacOSX 安装包吗?如果是这样,我只是使用错误吗?
我正在使用 PackageMaker 3.0.4 制作一个安装包,其中包含需要安装到系统目录的 .kext 和 .plugin 文件。我的目标是创建一个 .pmdoc
我只是不敢相信有人真的在使用它,因为我遇到了很多错误,我不知道有人如何设法让它为他们工作。我不相信我正在做任何特别不寻常的事情,但几乎每次我打开 .pmdoc 进行编辑(甚至从命令行构建它时),PackageMaker 都会任意更改我的设置。特别是权限,还有路径。
从命令行来看,这尤其令人恼火,因为我们在构建安装程序时使用了 .pmdoc...所以我们最终得到了一个损坏的安装程序,因为 PackageMaker 已经消失并弄乱了各种(重要!)权限 - 这意味着 .kext 文件不能负载等。
在这个阶段,最好的解决方法似乎是编写一个 postflight 脚本来修改命令行上的权限,然后让 PackageMaker 随意破坏权限。这并没有解决它所做的其他更改(有时甚至导致文件损坏到我什至无法再打开 .pmdoc 的地步。
那么...是否有人真正成功地将 PackageMaker 集成为其构建的一部分还是它真的像看起来那样从根本上被破坏了,而其他人都太聪明了,甚至不敢碰它?
I'm using PackageMaker 3.0.4 to make an install package that includes .kext and .plugin files that need to be installed to system directories. My goal is to create a .pmdoc
I just can't believe that anybody is actually using it because I have hit so many bugs that I don't know how anybody has managed to get it working for them. I don't believe I'm doing anything particularly unusual, but almost every time I open a .pmdoc to edit (or even when building it from the commandline) PackageMaker will arbitrarily change my settings. Particularly permissions, but also paths.
It is particularly infuriating from the commandline because we're using the .pmdoc when building the installers... so we end up with a broken installer because PackageMaker has gone and messed up the various (important!) permissions - meaning .kext files cannot load and the like.
At this stage the best workaround seems to be writing a postflight script that will modify the permissions on the commandline, and just leave PackageMaker to break the permissions however it wants to. This doesn't address the other changes it makes (sometimes even causing the files to be corrupt to the point I can't even open the .pmdoc anymore.
So... has anybody actually managed to successfully integrate PackageMaker as part of their build process? Or is it really as fundamentally broken as it seems and everyone else is too wise to even touch it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试命令行选项 [--no-recommend, -m]。但是,在打包之前,您必须对所有文件设置正确的权限。
参考: 包装工男人
You could try commandline option [--no-recommend, -m]. However, you will have to set correct permissions on all your files before packaging.
ref: man packagemaker
我遇到了类似的问题,并且刚刚偶然发现了一个有趣的观察结果。
具体来说,问题是当使用 packagemaker 创建包含 kext 的 pkg 时,pkg 中的 kext 文件和文件夹的权限有时会使用正确的权限(例如 rw-r--r--)创建,并且有时不是(例如 rw-rw-r--)。我相信这与您的问题类似,但我不使用 pmdoc 并且始终从命令行运行 packagemaker。但我确实相信,我们正在经历的根本问题是相同的。
我花了一段时间才发现其中的区别。如果 kext 的副本驻留在 /System/Library/Extensions 中并被加载,则将使用具有正确权限的 kext 文件创建 pkg。从 /System/Library/Extensions 卸载并删除 kext,并且使用错误的权限创建 pkg。这太疯狂了!
我对安装程序所做的事情与您的建议类似 - 我有一个 postflight 脚本,可以正确设置 kext 文件的所有权限。不过,我一直看到间歇性的安装错误发生。对于某些用户来说,运行安装程序时,主安装窗口将报告成功,但会出现一个单独的对话框,指出“系统扩展无法使用”并且“安装不正确”。即使重新启动后,驱动程序也无法加载。我的 postflight 脚本工作正常,因为安装的 kext 的权限是正确的。也可以使用 kextload 手动成功加载驱动程序。
我追踪到的是似乎有一个小窗口,其中安装的 kext 权限不正确。这是将 kext 文件(具有错误权限)复制到正确位置和执行 postflight 脚本之间的时间。
所以,我最终偶然发现了这个建议: http://osdir.com/ ml/darwin-kernel/2010-03/msg00017.html。不要将 kext 安装到 /System/Library/Extensions,而是将其安装到其他临时位置。然后,在 postflight 脚本中,将此临时副本的权限设置为正确的 kext 权限,然后将其移至 /System/Library/Extensions 文件夹中。我还没有尝试过,但确信它会起作用。
或者,您可以按照 Vishal 的建议进行操作,这是一些 Apple 文档建议您执行的操作。但是,我不太喜欢这个解决方案。这意味着我们的构建系统必须创建 root 拥有的文件,因此,每当我进行更改并再次构建时,都需要我输入密码。构建时输入密码似乎不太正确。
I am having similar issues and have just stumbled across an interesting observation.
To be specific, the problem was that when using packagemaker to create a pkg containing a kext, the permissions of the kext files and folders in the pkg were sometime being created with the correct permissions (e.g. rw-r--r--) and sometimes not (e.g. rw-rw-r--). I believe this is similar to your problem, but I don't use a pmdoc and always run packagemaker from the command line. I do believe, though, that the underlying issues we are experiencing is the same.
It took me a while to discover the difference. If a copy of the kext resides in /System/Library/Extensions and is loaded, then the pkg is created with the kext files having the correct permissions. Unload and delete the kext from /System/Library/Extensions and the pkg is created with the wrong permissions. This is insane!
What I was doing with my installer was something similar to what you suggest - I have a postflight script that sets all the permissions correctly on the kext files. I have been seeing intermittent installation errors occurring though. For some users, when running the installer, the main installation window will report success but a separate dialog will appear stating that the "System extension cannot be used" and that it was "installed improperly". The driver then fails to load, even after a reboot. My postflight script is working correctly since the permissions of the installed kext are correct. The driver can also be successfully loaded manually using kextload.
What I traced this back to is that there seems to be a small window where the installed kext permissions are incorrect. This is the time between when the kext files (with the wrong permissions) are copied into the correct location and when my postflight script is executed.
So, I eventually stumbled across this suggestion: http://osdir.com/ml/darwin-kernel/2010-03/msg00017.html. Instead of installing the kext to /System/Library/Extensions, install it to some other temporary location. Then, in the postflight script, set the permissions of this temporary copy to the correct kext permissions and then move that into the /System/Library/Extensions folder. I've yet to try it out but am sure it will work.
Alternatively, you could do what Vishal suggests which is what some of the Apple docs suggest you do. However, I don't really like that solution. It means our build system has to create files that are owned by root and, consequently, whenever I make changes and build again, it would require me to enter my password. Entering passwords when building doesn't really seem right.