• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Get Value From User?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get Value From User?


  • Subject: Re: Get Value From User?
  • From: Bill Coderre <email@hidden>
  • Date: Mon, 20 Apr 2009 10:00:41 -0700


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.)


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Get Value From User? (From: Paul Cook <email@hidden>)

  • Prev by Date: Re: Get Value From User?
  • Next by Date: Re: Customize or suppress the Installation Type pane
  • Previous by thread: Re: Get Value From User?
  • Next by thread: Environment variables available only from Cocoa apps
  • Index(es):
    • Date
    • Thread