我正在更新一些构建脚本,以使用pkgbuild而不是PackageMaker,但我没有看到需要在组件包上重新启动的选项。在PackageMaker中,需要重新启动可以使用以下两种方法之一:
对于pkgbuild或其组件包plist,我没有看到任何类似的选项。我理解,当我们使用productbuild构建发行版时,我们可以选择使用分发文件的pkg-ref>onCon结论键,在每个包的基础上重新启动。但是,这是现在(不使用PackageMaker)的唯一方法吗?如果是这样的话,我想知道为什么这个需求会从组件包中移到依赖于它们的发行版中。在我看来,当组件包能够指定自己的需求时,它们仍然是更加模块化的。
编辑:如果在结果PackageInfo中设置postinstall=“重新启动”,则可以强制重新启动。现在的问题只是如何教pkgbuild自动将其写入PackageInfo-文件。
发布于 2012-06-20 10:11:22
不可能通过参数或component.plist来完成这一任务。
因此,我通过使用shell脚本扩展、编辑和平放包来做到这一点:
#Replace the value of the postinstall-action attribute to restart
echo "Expanding archive ${BDIR}/${NAME}-Installer.pkg"
pkgutil --expand "Installer.pkg" installertmp
echo "Replacing postinstall-action \"none\" with \"restart\""
sed -e 's/postinstall-action=\"none\"/postinstall-action=\"restart\"/' -i '' installertmp/PackageInfo
echo "Flattening archive Installer.pkg"
pkgutil --flatten installertmp "Installer.pkg"
rm -f -r "installertmp"https://stackoverflow.com/questions/10980128
复制相似问题