所以我为我们公司打包一个打印机工具,包括两个.pkg文件(驱动程序)和一个.app文件。
现在我使用以下命令构建软件包:
pkgbuild --root ./content --script ./scripts --identifier com.MyGreatCompany --version 0.1 --install-location /tmp/ ./PrinterTool.pkg
因此,在安装软件包时,所有内容都放在/ tmp /目录中。然后,安装后脚本完成安装,如下所示:
installer -verbose -pkg /private/tmp/PackageOne.pkg -target /
installer -verbose -pkg /private/tmp/PackageTwo.pkg -target /
/bin/rm -rf /Applications/Utilities/PrinterTool.app
/bin/mv -f /private/tmp/PrinterTool.app /Applications/Utilities/PrinterTool.app
这种作品。第一次安装尝试进展顺利,但是当我试图重新安装相同的软件包时出现问题。 .app文件未复制到/ tmp文件夹,因此不会移动到Utilities文件夹。
所以我想知道两件事:
答案 0 :(得分:4)
是的......你不想这样做:D
首先,您不需要创建子包,只是不需要。您可以在同一个pkg文件中包含多个包。使用--components
标志来定义它们(或创建组件属性列表)。在rootdir中构建整个文件系统。所以在你的情况下你会有:
.../content/Applications/Utilities/PrinterTool.app
.../content/Library/...wherever.../driver-whatever.
然后您的--install-location
只是/
。
如果你真的需要多个包(或者它只是更方便),那么你想使用productbuild
来组合它们。您可以传递多个--package
选项来创建多包安装程序。