Re: PackageMaker 3.0.1 and requirement script
Re: PackageMaker 3.0.1 and requirement script
- Subject: Re: PackageMaker 3.0.1 and requirement script
- From: Stéphane Sudre <email@hidden>
- Date: Mon, 3 Mar 2008 23:54:18 +0100
On Mar 3, 2008, at 7:33 PM, Steven Meyer wrote:
I am having difficulties running a shell script from the
Requirements of an installer distribution.
How do I add a shell script to a distribution package so that it
will be run in the requirements? This is packagemaker 3.0.1.
I'll describe my problems more specifically
I am selecting "script for target "in the requirements. My script
is exiting 0, but the check fails. Looking at "Distribution.dist"
in raw editing mode, I see a javascript routine defined.
function pm_volume_check() {
if(!(system.run('/Users/stevenmeyer/scripts/check_target.sh') ==
true)) {
my.result.title = 'Failure';
my.result.message = 'Cannot install to volume';
my.result.type = 'Fatal';
return false;
}
return true;
}
in the documentation system.run returns the exit code of the
script, so the statement "(system.run('/Users/stevenmeyer/scripts/
check_target.sh') == true)" is wrong. Exiting with 1, however gets
a passed requirement check.
That problem dealt with, I find another which stumps me. The
absolute path of the script is coded into the javascript.
system.run looks for a script in the the /content/Resources/ . I
add scripts to the Resources folder in raw editing mode but
javascript does not find them. If I knew the installers path while
in javascript, I could perhaps work around this by calling my
script with an absolute path. Looking in the documentation, I find
nothing about installer path while in javascript.
So,
How do I put my script in content/resources?
Manually or through a shell script (which would mean, you may need to
build your package/distribution script through the PackageMaker
command line).
or
How can I find the installer path in javascript so that I can call
script placed elsewhere?
Or any other solution would be fine.
I am trying to discover if photoshop is on a volume, where it is
and what version. I can handle that pretty much from the shell. I
do not know how to do this from javascript.
I haven't found a public distribution script from Apple that uses
system.run so far.
But maybe you could just be as cheap as the iTunes distribution
script. It only check for the presence of iTunes in /Applications.
function VolumeCheck()
{
// do not downgrade
var plist = system.files.plistAtPath("/Applications/
iTunes.app/Contents/Info.plist");
// no iTunes = install
if ( !plist ) {
return true;
}
if ( plist.CFBundleShortVersionString &&
(system.compareVersions(plist.CFBundleShortVersionString, '7.6.1') !=
1) ) {
return true;
}
my.result.message = system.localizedStringWithFormat
('isDowngrade');
my.result.type = 'Fatal';
return false;
}
Of course, it's cheap. But hey, it's been distributed to thousands of
users and it hasn't made oceans rise.
I would have thought that maybe it could be possible to locate the
application through the JavaScript extensions but it only deals with
running applications. And it doesn't seem like you could use a
{token} for the path (or maybe you can but since this is not
documented, there's no way to know about it).
_______________________________________________
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