[英]How do I copy a config placed along side a .pkg file in dmg. Can't access it from PackageMaker “preflight” script
I want to make my installer copy a config file is placed in same directory as the PKG. 我想让我的安装程序复制一个配置文件,该配置文件与PKG放在同一目录中。 The .pkg + config file would be distributed as a DMG.
.pkg +配置文件将作为DMG分发。
I need the installer to copy this config file to a particular folder as part of install process. 在安装过程中,我需要安装程序将此配置文件复制到特定文件夹。 ${PACKAGE_PATH} is an environment variable which is set by the installer and could be used to get the path to config file... But, this doesn't work when the .pkg is run from a mounted dmg (requires user to extract files to file system).
$ {PACKAGE_PATH}是由安装程序设置的环境变量,可用于获取配置文件的路径...但是,当从已挂载的dmg运行.pkg时,此功能不起作用(需要用户提取文件到文件系统)。
Is there any way around this? 有没有办法解决?
Our application has a config file that organizations customize to their liking and then they would distribute this config file in the same directory as the .pkg. 我们的应用程序有一个配置文件,组织可以根据自己的喜好对其进行自定义,然后将其分发到与.pkg相同的目录中。
We got around this issue before by making a simple deploy tool that customer drag and dropped their .pkg and config file on and it'd generate for a customized pkg with it embedded. 我们通过制作一个简单的部署工具来解决此问题,客户可以将客户的.pkg和config文件拖放到该文件上,并生成嵌入其中的自定义pkg。
Mountain Lion now requires pkg installers to be signed which prevents us from inserting custom files without resigning it. Mountain Lion现在要求对pkg安装程序进行签名,这可以防止我们插入自定义文件而无需退出。
So, my options are: 因此,我的选择是:
$1
and $PACKAGE_PATH
, both give the full path to the installation package the Installer application is processing. $1
和$PACKAGE_PATH
都提供安装程序正在处理的安装包的完整路径。 For example: /Volumes/Users/Vikrams/Desktop/TestPkg.pkg
例如:
/Volumes/Users/Vikrams/Desktop/TestPkg.pkg
It should work even when installer is run from mounted dmg. 即使从已安装的dmg运行安装程序,它也应该可以工作。 You can get more information at Scripting in Packagemaker .
您可以在Packagemaker中的脚本获取更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.