Re: package javascript reference?
Re: package javascript reference?
- Subject: Re: package javascript reference?
- From: Andy O'Meara <email@hidden>
- Date: Sun, 04 Dec 2011 12:55:04 -0600
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?
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.
Andy
>
> If you give me more information about what specifically you want to test, I'll try to suggest an answer.
>
> As for the missing JavaScript document, I'll look into why it went missing.
>
>
> On Dec 2, 2011, at 7:11 AM, Andy O'Meara wrote:
>> Hey Stephane, long time! :) As always, you're a kind and generous help here on installer-dev.
>>
>> With some google sleuthing, I found a host copy of the now-removed javascript installer docs:
>>
>> http://www.filibeto.org/unix/macos/lib/dev/documentation/DeveloperTools/Reference/InstallerJavaScriptRef/InstallerJavaScriptRef.pdf
>>
>> As you said, it lists to message method of any kind, which is really quite sad since a message/confirm dialog box isn't a security issue. Around once a year the OS X installer subsystem always seems to want to push me to an early, frustration-induced grave ugh. So basically the only way to display an installer message is to authenticate and then run a shell script -- sigh.
>>
>> A workaround is to insert my checks in preflight, but I can't get the returned preflight error code to cause the appropriate string error message to appear (instead the generic default message always appears: "The installer encountered an error that caused the installation to fail…"). Anyone know if there's a way to get your own message in there?
>>
>> Thanks,
>> Andy
>>
>>
>>
>> On Dec 2, 2011, at 3:44 AM, Stephane Sudre wrote:
>>
>>> The complete answer:
>>>
>>> The Installer JavaScript Reference guide has been removed from the ADC
>>> web site many months ago. There's no reason why (maybe someone was
>>> absolutely hating it).
>>>
>>> Anyway, it's possible to find it in previous old Xcode distributions
>>> and you can not display a message box with the APIs. You need to use
>>> an external tool to do this.
>>>
>>> On Fri, Dec 2, 2011 at 6:10 AM, Andy O'Meara
>>> <email@hidden> wrote:
>>>>
>>>> Hey gents,
>>>>
>>>> I've been trying to get docs on the full list of javascript commands available from inside a package .dist file despite my best googling efforts. I'm trying to display a message box with an ok and cancel button, so if anyone has any leads it would be very appreciated. Perhaps there's a good link that goes into an available command reference?
>>>>
>>>> Thanks in advance,
>>>> Andy _______________________________________________
>>>> 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
>>
>> _______________________________________________
>> 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
>
_______________________________________________
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