Re: How to warn users in the installer that 10.2 is required?
Re: How to warn users in the installer that 10.2 is required?
- Subject: Re: How to warn users in the installer that 10.2 is required?
- From: Starman <email@hidden>
- Date: Mon, 16 Jun 2003 23:31:43 -0400
Thanks! That worked perfectly.
The only thing I had to do was create an English.lproj folder for
VolumeCheck.strings to live, and then it worked as advertised.
Mike
--
On Monday, June 16, 2003, at 11:07 PM, Shawn Erickson wrote:
On Monday, June 16, 2003, at 07:15 PM, Starman wrote:
Hi all,
I'm trying to see if there's a simple way to tell users BEFORE the
installation process starts that 10.2 is required, and that the app
won't install if they're running pre-Jag. I can't seem to figure out
how to do this in PackageMaker without the installer starting the
installation process.
I ripped the following out of an Apple installer... the files need to
be setup as a resource that is added to your installer package. You
can mine Apple installers for all kinds of good stuff ;-)
The following is from a file called "VolumeCheck" and it is used
during the volume selection (install location) phase and it will limit
what can be selected.
#!/usr/bin/perl
#######################################################################
#############
my $SYSTEM_VERS =
"$ARGV[0]"."/System/Library/CoreServices/SystemVersion.plist";
my $TARGET_VOLUME = "$ARGV[0]";
my $EXIT_VALUE = 0;
#######################################################################
#############
DO_CHECKS: {
if( ! -e "$SYSTEM_VERS" ) {
$EXIT_VALUE = (( 1 << 5 ) | 16 );
last;
}
if( CheckVersion("$SYSTEM_VERS", "10.2.5", "ProductVersion", "<" )) {
$EXIT_VALUE = (( 1 << 5 ) | 17 );
last;
}
}
exit($EXIT_VALUE);
#######################################################################
#############
sub CheckVersion
{
my $path = $_[0];
my $version = $_[1];
my $keyName = $_[2];
my $operator = $_[3];
if (! -e $path) {
return 0;
}
if (!$operator) {
$operator = "==";
}
my $oldSeperator = $/;
$/ = \0;
open( PLIST, "$path") || do {
return 0;
};
$plistData = <PLIST>;
$plistData =~ /<dict>(.*?)<\/dict>/gis;
@items = split(/<key>/, $plistData);
shift @items;
foreach $item (@items) {
$item =~ /(.*?)<\/key>.*?<string>(.*?)<\/string>/gis;
$versiondata{ $1 } = $2;
}
close(PLIST);
$/ = $oldSeperator;
# ProductBuildVersion style keys
$versiondata{$keyName} =~ /(\d+)([A-Z])(\d+)/ &&
($versiondata{$keyName} = "$1.".ord($2).".$3");
$version =~ /(\d+)([A-Z])(\d+)/ && ($version =
"$1.".ord($2).".$3");
@theVersionArray = split(/\./, $versiondata{$keyName});
for ($i = 0; $i < 3; $i++) {
if(!$theVersionArray[$i]) {
$theVersionArray[$i] = '0';
}
}
@versionArray = split(/\./, $version);
my $actualVersion;
for ($i = 0; $i < 3; $i++) {
if (($theVersionArray[$i] != $versionArray[$i]) or ($i == 2)) {
$actualVersion = $theVersionArray[$i];
$version = $versionArray[$i];
last;
}
}
my $expression = '$actualVersion ' . $operator . ' $version';
if( eval ($expression) )
{
return 1;
}
else
{
return 0;
}
}
The following is from "VolumeCheck.strings" and is used for display in
the installer...
"16" = "This driver requires Mac OS 10.2.5 or later installed.";
"17" = "This driver requires Mac OS 10.2.5 or later.";
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.