How do I get user input into a PackageMaker package?

末鹿安然 提交于 2019-12-07 07:53:19

问题


I'm trying to create an install package. I've got all my components, and I think I understand most of the process. I want to have an install/set-up script that is run as part of the install. I planned to put it either as a post-install action or a post-install script.

The problem is that I need user-input. I can't figure out how to either get user input into the script, or how to add a page in the install UI that has a place for user input and then pass that on to the script.

I guess, I could write an apple-script with a dialog to ask the question, and then pass that information on to my shell script (or, write the whole thing in the applescript) but that seems unnecessarily complicated...

Is there a normal way to do this?

Thanks


回答1:


You can create an Installer Plug-in, which is a Cocoa loadable bundle that can contain your own user interface and code. When you add a plug-in to the Installer package, the Installer app will display your plug-in's UI as an additional step in the installation process.

The Apple sample code and only available documentation is here. There is a great explanation of the process here.

Unfortunately, inserting the plug-in bundle into your installer package has become needlessly difficult as of PackageMaker 3.0 and its flat package format.

Once you've created your plug-in bundle, you first need to build your installer package as normal. Once it's built, you need to go to the Edit menu in PackageMaker and open the Flat Package Editor. Open your installer bundle, and insert the plug-in in the appropriate location as you would in the Finder with a 2.0 installer bundle. That is, you need to create a Plugins folder and inside that you must insert your bundle plus the InstallerSections.plist file (which the sample above explains).




回答2:


Can you expand on this at all? I've copied those two "files" into a Plugins directory via the Flat Package Editor like you said. However, after saving, closing, and re-opening the package, the plugins directory is gone.



来源:https://stackoverflow.com/questions/2898964/how-do-i-get-user-input-into-a-packagemaker-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!