Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/perl -w
- ###################################################################
- #
- # Make sure the user's system is one we should be installing on
- # i.e. The driver no longer supports PPC machines, so don't run the installer
- # on a PPC machine.
- #
- # Copyright WACOM Technologies, Inc. 2012
- # All rights reserved.
- ###################################################################
- use strict;
- use Env;
- use File::Basename;
- my $CPU_TYPE_MC680x0 = 6;
- my $CPU_TYPE_X86 = 7;
- my $CPU_TYPE_MC98000 = 10;
- my $CPU_TYPE_HPPA = 11;
- my $CPU_TYPE_ARM = 12;
- my $CPU_TYPE_MC88000 = 13;
- my $CPU_TYPE_SPARC = 14;
- my $CPU_TYPE_I860 = 15;
- my $CPU_TYPE_POWERPC = 18;
- ###################################################################
- sub main
- {
- my $installationCheck_location = dirname($0);
- my $parameter1 = 'tell application "Finder"';
- my $parameter2 = 'activate';
- my $parameter3 = 'display dialog "This driver will not run on a PowerPC machine. Please install version 6.1.6"';
- my $parameter4 = 'end tell';
- my $returnValue = 0;
- my $swVersion = `sw_vers -productVersion`;
- my $swMinorVersion = 0;
- $ENV{PATH} = "";
- delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
- print "Begin Installation Check\n";
- #my $theArchictectureType = system(qq(/usr/sbin/sysctl), qq(hw.cputype));
- my $theArchictectureType = `/usr/sbin/sysctl -n hw.cputype`;
- print "theArchictectureType = $theArchictectureType\n";
- #is this is a PPC machine? Then quit, and explain why to the user via a dialog using Applescript
- if ($theArchictectureType == $CPU_TYPE_POWERPC){
- #if ($theArchictectureType == $CPU_TYPE_X86){
- print "Unsupported architecture:PPC\n";
- #rather than showing a dialog box here, return an failure code. Packagemaker will then
- #look up the correct localized string from installationCheck.strings, and show that in
- #a dialog. The string index will be the returned value - 96 (e.g. 112-96=16)
- $returnValue = 112;
- #system "/usr/bin/osascript -e '$parameter1' -e '$parameter2' -e '$parameter3' -e '$parameter4'";
- }
- if ($swVersion)
- {
- my $minorVersionNumber = int(substr($swVersion, 3,1));
- my $majorVersionNumber = int(substr($swVersion, 0,2));
- if(($majorVersionNumber == 10) && ($minorVersionNumber > 5))
- {
- #10.6 and newer are supported.
- print("Supported OS Version detected ",$majorVersionNumber,".", $minorVersionNumber);
- }
- else
- {
- print("Unsupported OS version ", $swVersion);
- $returnValue = 113;
- }
- }
- print "End Installation Check\n";
- exit ($returnValue);
- }
- ###################################################################
- main();
- ###################################################################
- __END__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement