How to pass arguments to package installer from mac terminal

这一生的挚爱 提交于 2019-12-05 07:51:19

This is not possible from the command since the "installer" command does not support any such arguments. However, you may try using a configuration file which you can read from pre/postinstall script and do the required actions.

In installer manual you can find something like this:

installer(8) [osx man page]

-applyChoiceChangesXML pathToXMLFile Applies the install choice changes specified in pathToXMLFile to the default choices in the package before installation. This allows the command-line installer to customize choice what gets installed. See CHOICE CHANGES FILE for details of this XML format. Any prob- lems encountered while applying the choice changes will be reported to the LOG_INSTALL facility (i.e. to /var/log/install.log), and also to stdout if -dumplog is used.

And section CHOICE CHANGES FILE says: installer(8) [osx man page]

CHOICE CHANGES FILE

A ``choiceChanges'' file allows individual installer choices to be selected or deselected. A template choiceChanges file for a given package can be generated with the -showChoiceChangesXML option, and is interpreted as follows.

The choiceChanges file is a property list containing an array of dictionaries. Each dictionary has the following three keys:

Key Description
choiceIdentifier Identifier for the choice to be modified (string)
choiceAttribute One of the attribute names described below (string)
attributeSetting A setting that depends on the choiceAttribute, described below (number or string)

The choiceAttribute and attributeSetting values are as follows:

choiceAttribute attributeSetting Description
selected (number) 1 to select the choice, 0 to deselect it
enabled (number) 1 to enable the choice, 0 to disable it
visible (number) 1 to show the choice, 0 to hide it
customLocation (string) path at which to install the choice (see below)

Note that there can be multiple dictionaries for the same choiceIdentifier, since there can be multiple attributes set for a single choice.

The customLocation attribute can be set for a choice only if that choice explicitly allows a user-defined path. That is, if the choice would have a Location popup when viewed in the Customize pane of the Installer application, it can be set via customLocation. (Otherwise, instal- lation paths cannot be arbitrarily modified, since the package author must account for custom install locations for the installation to work properly.)

This xml can be generated before stating installation and you do not need script to process it (like other answer suggest).

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