Re: Checking network status as .mpkg requirement
Re: Checking network status as .mpkg requirement
- Subject: Re: Checking network status as .mpkg requirement
- From: Iceberg-Dev <email@hidden>
- Date: Sat, 30 Jan 2010 00:03:40 +0100
On Jan 29, 2010, at 4:39 PM, Chris Adamson wrote:
Building an .mpkg with PackageMaker...
I'm trying to do an up-front check for network connectivity, as I
have an installer plug-in that does a network authentication step,
and I don't want the user to have to progress through a read-me and
EULA if they're only going to fail to connect to the authentication
server later on.
For the individual .mpkgs, PackageMaker will copy external scripts
into the bundle, but that doesn't seem to be an option for the
"Requirements" of the distribution object, which seems to work only
with absolute paths. So I've tried to create the following
requirement:
require: true: result of script:
with the following values in the sheet:
if -> result of script
file path -> /sbin/ping -c 2 -W 5000 www.subfurther.com
The problem I'm seeing is that this rule always fails. Inverting
the "pass" flag from "true" to "false" doesn't seem to matter.
When I open up the distribution.dist file in the .mpkg, I see the
following line:
if(!(system.run('/sbin/ping -c 2 -W 5000 www.subfurther.com') ==
true)) {
whether or not the pass flag is set to "true" or "false". So, I'm
not really switching on the result of the ping at all.
Can anyone tell me the obvious stupid mistakes I'm making?
Not reading the documentation for system.run .
-------
run
Launches a given program in the Resources directory of the
installation package.
run(programName, args...) <---------------------------
Parameters
programName
Name of the program to execute.
args...
Arguments passed to the program. <-------------------
Return Value
After the program is executed, its exit code. If the program is not
executed (see discussion), undefined.
Discussion
The allow-external-scripts attribute of the options element in the
distribution definition must be 'yes' for the program to be launched.
And, the Installer application asks the user’s permission before
launching the program. See Distribution Definition Reference for more
information.
Availability
Available in Mac OS X v10.4 and later.
-------
2 notes:
- I would be surprised if a command line tool or script shell ever
returns true or false as is. I would rather compare with 0.
- There's a typo in the documentation for the runOnce method, the
example should read runOnce(programName, args...) and not run
(programName, args...).
_______________________________________________
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