简体   繁体   English

使用后安装脚本Mac OSX的安装失败

[英]Installation failed with postinstall script Mac OSX

I am trying to create package using pkgbuild and product archive using productbuild. 我正在尝试使用pkgbuild创建软件包,并使用productbuild创建产品归档。 Without scripts, the Installer installs the package successfully. 如果没有脚本,安装程序将成功安装软件包。 But with scripts, it fails. 但是使用脚本,它会失败。 I googled for it, but couldnt' find a working solution that fixes my issues. 我用Google搜索,但是找不到能解决我问题的有效解决方案。

pkgbuild --root GameDir --install-location /Applications --component-plist 'info.plist' --scripts ScriptsOSX Game.pkg pkgbuild --root GameDir-安装位置/ Applications --component-plist'info.plist'-脚本ScriptsOSX Game.pkg

The .app name is provided in the info.plist as RootRelativeBundlePath Dictionary value .app名称在info.plist中作为RootRelativeBundlePath词典值提供

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

script in GameDir/ScriptsOSX folder : postinsall.sh 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 // Execution permission for all, for testing purposes. 权限:-rwxr-xr-x @ 1个工作人员57 Dec 12 19:26 postinstall.sh //用于测试的所有人的执行权限。

fwiw : When Installation proceeds, it asks for admin password to proceed. fwiw:安装继续进行时,会要求管理员密码才能继续进行。 Hence I believe it has permission to run the script, in addition to the execution permission. 因此,我相信除了执行权限外,它还具有运行脚本的权限。

I attempted first using python script. 我首先尝试使用python脚本。 Though installation succeeded, the script did not execute. 尽管安装成功,但脚本未执行。 I am not sure why. 我不知道为什么。 All the examples had shell or perl script as installation script, hence attempting shell script. 所有示例都将shell或perl脚本作为安装脚本,因此尝试使用shell脚本。 But installation fails. 但是安装失败。 I am sure it is due to attempt at script execution. 我确信这是由于尝试执行脚本。 But not sure why. 但不确定为什么。 Any ideas? 有任何想法吗?

Thanks in advance 提前致谢

Sujatha 萨贾塔

EDIT : The info.plist that has post install script goes like this Its is an array of dictionaries, in which one of the key:value pair is : BundlePostInstallScriptPath = postinstall.sh 编辑:具有安装后脚本的info.plist如下所示:它是一个字典数组,其中key:value对之一是:BundlePostInstallScriptPath = postinstall.sh

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

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

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