2012-11-18 29 views
1

已经尝试过很多方法:PKGBUILD,productbuild不同,PackageMaker,软件包的应用...如何从这些文件构建Mac OS X安装程序包?

,我要构建的扁平封装的结构:

Distribution - xml script 
MacBookPro2011EFIUpdate.pkg - flat package 
Resources - resources folder, contains language localizations 

扁平封装信息:

id="com.apple.pkg.MacBookPro2011EFIUpdate" version="2.7.0.0.1.1330468277" 

例如,我的产品生成失败:

productbuild: error: Cannot copy package "MacBookPro2011EFIUpdate.pkg" into product. 
(Bundle-style package "MacBookPro2011EFIUpdate.pkg" is not supported.) 


请尝试从这些文件构建安装程序包:Link
而且,如果您成功了,请告诉您如何做到这一点!

回答

9

正确的命令使用的确是productbuild,但它只适用于Flat软件包,如错误所示。而你的MacBookPro2011EFIUpdate.pkg是一个Bundle风格的包:容易区分Bundle风格的包是一个目录,其中Flat包是一个xar归档。

为了得到你想要的东西,首先是捆绑式的包转换成扁包:
pkgutil --flatten MacBookPro2011EFIUpdate.pkg FlatMacBookPro2011EFIUpdate.pkg

然后生成一个使用这一新的扁平封装一个新的发行文件:
productbuild --package FlatMacBookPro2011EFIUpdate.pkg --synthesize newdist.dist

将您的脚本和资源条目从您的分发文件复制到newdist.dist。然后建立你的最终包:
productbuild --resources Resources/ --distribution newdist.dist MyCoolPackage.pkg

+0

嗨,我有一个mac应用程序文件,并使用“productbuild”,即hello.app和hello.pkg创建其包文件。现在我想为该软件包添加许可协议。为此,我已经从hello.app文件创建了distribution.xml,现在我希望将其包含在包中,但是因为不允许出现错误。 – Swati

+0

productbuild --synthesize --product“hello.app/Contents/Info.plist”--package hello.app distribution.xml – Swati

+0

<?xml version =“1.0”encoding =“utf-8”?> \t \t <安装贵脚本minSpecVersion = “1”> \t \t \t 我的实施例的应用 \t \t \t <许可证文件= “的license.html”/> \t \t \t <自述文件= “的README.html”/> \t \t \t ... \t \t \t ... \t \t Swati