• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to warn users in the installer that 10.2 is required?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Shawn Erickson <email@hidden>
  • Date: Mon, 16 Jun 2003 20:07:49 -0700

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.

  • Follow-Ups:
    • Re: How to warn users in the installer that 10.2 is required?
      • From: Starman <email@hidden>
References: 
 >How to warn users in the installer that 10.2 is required? (From: Starman <email@hidden>)

  • Prev by Date: Dividing an array into subgroups?
  • Next by Date: Re: Rendezvous & StartupItems
  • Previous by thread: How to warn users in the installer that 10.2 is required?
  • Next by thread: Re: How to warn users in the installer that 10.2 is required?
  • Index(es):
    • Date
    • Thread