1

我正在尝试使用 pkgbuild 创建软件包,并使用 productbuild 创建产品存档。如果没有脚本,安装程序会成功安装包。但是使用脚本,它会失败。我用谷歌搜索了它,但找不到解决我问题的有效解决方案。

pkgbuild --root GameDir --install-location /Applications --component-plist 'info.plist' --scripts ScriptsOSX Game.pkg

.app 名称在 info.plist 中作为 RootRelativeBundlePath 字典值提供

productbuild --distribution ./Distribution.xml --resources ../Resources --packagepath GamePkgDir GameInstaller.pkg

GameDir/ScriptsOSX 文件夹中的脚本:postinsall.sh

#!/usr/bin/env sh
open /Applications/Contacts.app/
exit 0

Permission : -rwxr-xr-x@ 1 staff 57 Dec 12 19:26 postinstall.sh // 所有人的执行权限,用于测试目的。

fwiw :当安装继续时,它会要求输入管理员密码以继续。因此,我相信除了执行权限之外,它还具有运行脚本的权限。

我首先尝试使用 python 脚本。虽然安装成功,但脚本没有执行。我不确定为什么。所有示例都有 shell 或 perl 脚本作为安装脚本,因此尝试使用 shell 脚本。但是安装失败。我确信这是由于尝试执行脚本。但不确定为什么。有任何想法吗?

提前致谢

素佳塔

编辑:具有安装后脚本的 info.plist 如下所示它是一个字典数组,其中一个键:值对是:BundlePostInstallScriptPath = postinstall.sh

4

1 回答 1

3

可以随时查看/var/log/install.log更多信息。

于 2018-08-07T08:18:44.993 回答