Re: package javascript reference?
Re: package javascript reference?
- Subject: Re: package javascript reference?
- From: Stephane Sudre <email@hidden>
- Date: Mon, 05 Dec 2011 11:54:26 +0100
On Sun, Dec 4, 2011 at 7:55 PM, Andy O'Meara
<email@hidden> wrote:
>
> On Dec 2, 2011, at 11:57 PM, Bill Coderre wrote:
>
>> I'm not understanding what it is that you want to test and report an error about, that you can't do it in the distribution, and must do it in the preflight.
>
>
>
> It's first worth mentioning how we've decided to do things now that we're using a .dist-style pkg (where InstallationCheck is now ignored). The short version is that we've moved what was in InstallationCheck to preflight. An obstacle has been that none(!) of the OSes have a mechanism that translates the returned error code into a string that the installer displays (such as how InstallationCheck did business). This to me, is a VERY simple, risk-free enhancement that would add a LOT of value to the OS X installer subsystem and makes no sense that it's not there. I mean, really. As it stands, the preflight has no way to communicate with the user unless it puts up its own message box. Anyway, so we made a C-style command line util that prints out the pid and bundle identifier for each running process. This allows our installation check to look for certain bundle identifiers and tell the user installation can't proceed by simply searching though the printed buffer. Some pseudocode:
>
> loop:
> textBuf = `$1/blah/install_util PrintRunningProcesses`
> if textBuf contains 'com.company.foo':
> result = `$1/blah/showmsg_util "dammit, quit foo or cancel"`
> if result == 'cancel':
> exit 1234
> else:
> break
> loopend
>
> Of course system.applications.fromIdentifier() could replace the above but in practice it can be cumbersome/annoying for the user to have to exit the installer, remember what application to quit (our customers are whitebelt users), and then rerun the installer. It's ideal to use a 'confirm' type message window (ie. an OK and Cancel button saying to quit the following and press OK or cancel installation) in a loop with calls to system.applications.fromIdentifier(). As it stands now, it can only be checked once so the user can get only the message and then have to restart the installer. I get though that the reason Apple didn't want this is for the command line invocation be airtight. So the next best solution would be to allow a new message type other than Fatal (such as 'FatalOrRetry'), which would put a 'Retry' or similarly titled button in the message window that the installer shows. Pressing it would cause the installation check function to be reexecuted, effectively allowing a loop to occur but be within the package installer's control. If in command line mode, FatalOrRetry would simply internally map to Fatal. This seems to be a solution that make a lot of sense, make a lot of people happy, and preserve full safety/termination guarantees of command line execution. It would allow a package that installs everything into the user's dir that needs to do the above not need to have admin permission. Thoughts? Think I should file a radar?
I would guess the issue is related to the state of the choices not
being refreshed as often as you would expect them to. I filed a bug
report sometimes ago about the state not being refreshed when you
click Go Back from this pane and then click Continue.
It's always a good idea to file a bug report (even though it can take
quite a long time to get a bug fixed in the system - for instance the
one with the Restart… button of the Startup Disk Pref Pane that has
been there since at least 2002).
> While we're talking about this stuff, is there a undocumented way to tell the PackageMaker UI to not overwrite my.result.title and my.result.message when it generates it top level javascript install check function? As it is now, if you have a javascript set my.result.title and my.result.message, they get wiped out because the packagemaker's make process always takes what was put in the UI edit fields and overwrites them in its installation check wrapper javascript proc. We make our pkg/dist by command line, so if we did start using javascript, we'd have too script the editing of the .dist file to remove the lines that overwrite the title and message.
It's safer to write your own InstallationCheck JavaScript script and
not rely on PackageMaker as it would anyway produce non optimized code
like this:
a = true & b;
_______________________________________________
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