On Apr 17, 2009, at 9:41 PM, Paul Cook wrote: Is there anyway from any kind of any Installer script (preflight, postflight, etc.) to ask the user for a value and to get that value from within a script? (Bash, Perl, AppleScript, etc.)
Does this iHook thing do this stuff?
Preflight and postflight scripts are "any" unix executable, so you can do anything up to and including running a Cocoa app. (See the documentation for the allowed name/owner/group/permissions combinations.)
They are run as root (if you ask for root authorization), so if you have UI, you probably want to write a teeny script that says something like #! /usr/bin/perl
exit 0 if $ENV{COMMAND_LINE_INSTALL}; my $input = `su $ENV{USER} -c /whatever/you/really/want`;
# Do unspeakable things with the input
# and then always exit 0;
Note that I am using su to pose as the user who double-clicked the installer (which is hidden in the environment variable USER), so that the program that interacts will come up in that user's preferred language.
Note also that if the user runs your installer from the command line, or on a remote machine via ARD, attempting to run user programs WILL hang the install. That's why the first executable line.
(I just use perl all the time. You can do the same thing in sh, but I hate sh.)
|