简体   繁体   English

如何复制dmg中.pkg文件旁边的配置。 无法从PackageMaker“预检”脚本访问它

[英]How do I copy a config placed along side a .pkg file in dmg. Can't access it from PackageMaker “preflight” script

My Question 我的问题

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? 有没有办法解决?

Background info for why I want to do 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. Create a webapp that customers can upload their files to and get a customized signed pkg which is kind of a pain. 创建一个Webapp,客户可以将其文件上传到该Webapp并获得自定义的已签名pkg,这有点麻烦。
  2. Extend my deploy tool to sign the package. 扩展我的部署工具以对程序包进行签名。 This isn't ideal as it'd basically require us to distribute our private key which is a big no no. 这是不理想的,因为它基本上要求我们分发我们的私钥,这是很大的不。
  3. Hope there is a simpler solution... like the DMG approach i'm asking about. 希望有一个更简单的解决方案...就像我要问的DMG方法一样。

$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.

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