Post

Replies

Boosts

Views

Activity

Access to the choices global variable in installation-check script?
Is it possible to access the choices global variable in an installation-check script when the package doesn't have choices that the end-user can interact with? I'm referring to this: https://developer.apple.com/documentation/installer_js/choice It seems to imply that you can access the choices global variable, but any attempt to do so fails. For example, take the following: <?xml version="1.0" encoding="utf-8"?> <installer-gui-script minSpecVersion="2"> &#9;&#9;<title>My Meta Package</title> &#9;&#9;<pkg-ref id="com.md4.myapp"/> &#9;&#9;<options customize="never" require-scripts="false" rootVolumeOnly="true" /> &#9;&#9;<choices-outline> &#9;&#9;&#9;&#9;<line choice="default"> &#9;&#9;&#9;&#9;&#9;&#9;<line choice="myapp"/> &#9;&#9;&#9;&#9;</line> &#9;&#9;</choices-outline> &#9;&#9;<choice id="default"/> &#9;&#9;<choice id="myapp" visible="false" title="this is a test" description="testing one" start_selected="true"> &#9;&#9;&#9;&#9;<pkg-ref id="com.md4.myapp"/> &#9;&#9;</choice> &#9;&#9;<pkg-ref id="com.md4.myapp" version="1" onConclusion="none">mypackage.pkg</pkg-ref> &#9;&#9;<installation-check script="version_check()" /> &#9;&#9;<script> <![CDATA[ function version_check() { &#9;&#9;title = choices.['myapp'].title; &#9;&#9;system.log("Performing custom installation check against version " + system.version.ProductVersion); &#9;&#9;system.log("Title " + title); &#9;&#9;return true; } ]]> &#9;&#9;</script> </installer-gui-script> This results in the following: Sep 8 15:32:56 THY-01-0236-LT Installer[85217]: IFJS: *** exception: SyntaxError: Unexpected token '['. Expected a property name after '.'. Is it possible to access the choices global variable in this manner? If so, what is the correct way/syntax to do it? Thanks in advance!
1
0
956
Apr ’21