home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- my $SYSVERS = "$ARGV[0]"."/System/Library/CoreServices/SystemVersion.plist";
- my $QUICKTIME_VERS = "$ARGV[0]"."/System/Library/Frameworks/QuickTime.framework/Versions/A/Resources/version.plist";
- my $EXIT_VALUE = 0;
-
-
-
- DO_CHECKS:
- {
-
- #
- # Target volume must contain a X system.
- #
- if($ARGV[0] ne "/")
- {
- $EXIT_VALUE = (( 1 << 6 ) | ( 1 << 5 ) | 16);
- last;
- }
-
-
- #
- # Don't install if target system is less than 10.2.5
- #
- if(CheckVersion( "$SYSVERS", "10.2.5", "ProductVersion", "<" ))
- {
- $EXIT_VALUE = (( 1 << 5 ) | 17);
- last;
- }
-
- # For a single binary QT installer we will now allow installation on 10.2.5 or higher
- # if(CheckVersion( "$SYSVERS", "10.3", "ProductVersion", ">=" ))
- # {
- # $EXIT_VALUE = (( 1 << 5 ) | 18);
- # last;
- # }
-
- if (CheckVersion("$QUICKTIME_VERS", "6.5", "CFBundleVersion", ">")) {
- $EXIT_VALUE = (( 1 << 5 ) | 19);
- last;
- }
- #
- # Run the installinfo "preinstall" tool.
- #
- my $packagepath = "";
-
- $packagepath = $ENV{'PACKAGE_PATH'};
-
-
- if ("$packagepath" ne "") {
- my $installinfotool = "$packagepath"."/Contents/Resources/installinfo";
-
- my $cmd = "\"$installinfotool\" -preinstall -volume \"$ARGV[0]\"";
- system("$cmd");
- }
-
- }
-
- 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;
-
- @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;
- }
-
- }
-