The script checks for the presence of the XQuartz application. If it finds it, it read’s it’s version number from inside the bundle. Then depending on that version number, it exits with an exit code of 0 (install needed) or 1 (install NOT needed). I can run the script externally, and it behaves as I would expect. But when I set it as a requirement in Packages, regardless of the scripts exit state, the custom install choice remains visible and selected. On Jan 6, 2014, at 1:59 PM, Andrew Keller <andrew@kellerfarm.com> wrote:
On Jan 6, 2014, at 3:21 PM, Conor Schutzman wrote:
I am installing a custom X11 application. As part of that installation, I want to check if the latest version of XQuartz is present, and if not, install it.
Using Packages, I imported the XQuartz package, and set it as a custom install choice. I then added a requirements entry for that package, using the “Result of External Script” option. I set the options to look for a return value “equal to” 0, and if that requirement is not met, to “make this choice unelectable” and add a tooltip.
Below is my script, the XQuartz package in the custom install screen is selected and available in all cases, I was hoping someone could help me determine why this isn’t working.
<script> #!/usr/bin/env bash
# Package Title: Safeword SofToken II 2.2.0 # Author: Conor Schutzman <cschutzm@cisco.com>
if [[ -e /Applications/Utilities/XQuartz.app ]]; then XQuartzVersion=$(defaults read "/Applications/Utilities/XQuartz.app/Contents/Info.plist" CFBundleShortVersionString) if [[ "$XQuartzVersion" = "2.7.5" ]]; then exit 1 else exit 0 fi fi exit 0 </script>
I don't fully understand what that script is checking for or what is going wrong, but there is one detail that jumps out to me. According to the man page for `defaults`, if you wish to read an arbitrary file, you specify the full path, without the '.plist' extension. However, in the above code, the '.plist' extension is included.
Hope that helps, - Andrew Keller
_______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com