简体   繁体   English

使用自定义资源和脚本创建平面.pkg文件的脚本化方法

[英]Scriptable way to create flat .pkg files with custom resources and scripts

I have created a flat .pkg file with following options on 10.7 using PackageMaker 3.0.6: 我已经使用PackageMaker 3.0.6在10.7上创建了具有以下选项的纯.pkg文件:

/Applications/PackageMaker.app/Contents/MacOS/Package --root ./myroot \
 --id com.myroot.pkg --title "My Root" --scripts ./scripts --target 10.5 \
 --verbose --resources ./resources --root-volume-only --domain system \
 --no-relocate --versio 1.0 --certificate "My Cert Name"

In the resources folder I have background.png , Welcome.rtf and License.rtf and in the scripts folder I have preflight , postflight and various support files for those scripts. resources文件夹中,我具有background.pngWelcome.rtfLicense.rtf ,在scripts文件夹中,我具有preflightpostflight和这些脚本的各种支持文件。 The resulting .pkg appears to be fully functional except that the installer does not display my background, welcome or license. 生成的.pkg似乎功能齐全,但安装程序未显示我的背景,欢迎或许可证。

How can I add a custom background, welcome and license to a flat package? 如何为平面包装添加自定义背景,欢迎和许可?

As far as I can tell, the Distribution file in the .pkg is missing references to the background, welcome and license files. 据我所知,.pkg中的Distribution文件缺少对后台文件,欢迎文件和许可证文件的引用。

As a workaround I tried using xar . 作为解决方法,我尝试使用xar If I unpack the package with xar like so: 如果我用xar打开包装,如下所示:

xar -xf ./myroot.pkg -C work

and add the 3 tags for those files, then pack it again with xar: 并为这些文件添加3个标签,然后使用xar再次打包:

cd work && xar -cf ../myroot2.pkg *

I get a package that starts installation ok with my background etc., but when it comes time to install my .app I get these errors (from /var/log/install.log ): 我得到一个可以使用我的背景等开始正常安装的软件包,但是当需要安装我的.app时,我得到了这些错误(来自/var/log/install.log ):

 run preupgrade script for myroot
Could not create task for action: run preupgrade script for myroot2
Install failed: The Installer could not extract files from the package for myroot2. Contact the software manufacturer for assistance.
IFDInstallController 863170 state = 7

I have also tried Flat Package Editor: open myroot.pkg, drag out Distribution, edit it, drag it back, delete old Distribution, save. 我也尝试过Flat Package Editor:打开myroot.pkg,拖出发行版,对其进行编辑,将其拖回,删除旧的发行版,保存。 Same problem as with xar. 与xar相同的问题。

I would prefer to have a fully scriptable solution as opposed to using GUIs. 与使用GUI相比,我希望有一个完全可编写脚本的解决方案。

Edit: I have also tried to use pkgutil to expand, edit Distribution, and reflatten a flat package. 编辑:我也尝试过使用pkgutil扩展,编辑分发,并重新展平一个扁平包。 This gets the icons and readme in the installer, but the installer is then unable to unpack the payload. 这将在安装程序中获取图标和自述文件,但是安装程序随后无法解压有效负载。 Same if I reflatten with Flat Package Editor . 如果使用Flat Package Editor重新整理,则相同。 I have also tried to create an expanded package without PackageMaker (which works, except on 10.8), but when I try to flatten that with pkgutil the result is a corrupted package again. 我也尝试过创建一个不带PackageMaker的扩展软件包(该软件包可以在10.8上使用),但是当我尝试使用pkgutil将其扁平化时,结果再次是损坏的软件包。

PackageMaker always was buggy has hell, and got deprecated with Mac OS X 10.6 Snow Leopard. PackageMaker始终是越野车的地狱,而Mac OS X 10.6 Snow Leopard弃用了它。

You should use pkgbuild together with productbuild . 您应该将pkgbuild与productbuild一起使用

This Mac Installers Blog has some useful posts about Packagemaker including details about the usage and solutions to common problems. Mac Installers博客中有一些有关Packagemaker的有用文章,包括有关用法和常见问题解决方案的详细信息。 Hope it will help. 希望它会有所帮助。

Check out the Luggage - it's a Makefile helper file that lets you create OS X packages with sane Makefiles. 看看行李 -这是一个Makefile帮助程序文件,可让您使用健全的Makefile创建OS X软件包。 Disclaimer: I am the original author for it, though there are a lot of other people's contributions in it now. 免责声明:我是它的原始作者,尽管现在有很多其他人对此做出了贡献。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM