• 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: Installer Check to see if it's an Intel Mac
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installer Check to see if it's an Intel Mac


  • Subject: Re: Installer Check to see if it's an Intel Mac
  • From: Sherm Pendley <email@hidden>
  • Date: Mon, 29 May 2006 14:36:37 -0400

On May 29, 2006, at 1:29 PM, Matthew Brewer wrote:

Okay, I’ve read up on InstallationCheck and the strings and all that and I’m
about at the same point I was before.


The suggestion to use “arch” is fine, but I’m not well acquainted with
scripting of any sort. So, I can call this command, and it returns a value.

Just to pick nits, you're interested in the output printed by the command, not its return value. Ever wonder why main() is declared as returning an int? This is why - the int that's returned from main() is the return value that's passed to the parent process.


And I would assume I would want to check that it is “i386” and break if it
isn’t (via the InstallationCheck returning a determined value of 16-31, from
what I understand).


So, anyone got any suggestions? I’m still just a tad confused here.

The script has to be able to run its check on older systems as well as Intel - that's the whole point. So, you can write it in any scripting language that's been included with Mac OS X from day zero - Perl, Python, Sh, etc. Of those, Perl's the one I'm most familiar with, so here's how I'd write that script in Perl:


	#!/usr/bin/perl

# The above #! is called the "shebang" line, and it must be the *first* line of
# a script. It's used by the OS to find the interpreter which will run the script.


	# Does the output of arch contain "ppc"?
	if (`/usr/bin/arch` =~ /ppc/) {

		# If so, return "a determined value of 16-31"
		return 16;   # Random & arbitrary example here
	}
	return 0;

In Perl, calling return() from the top level (that is, not from within a subroutine) will exit the script and return the specified value to the script's parent, just like returning a value from main() would do in a C program.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >RE: Installer Check to see if it's an Intel Mac (From: Matthew Brewer <email@hidden>)

  • Prev by Date: Re: Installer Check to see if it's an Intel Mac
  • Next by Date: Re: Installer Check to see if it's an Intel Mac
  • Previous by thread: Re: Installer Check to see if it's an Intel Mac
  • Next by thread: Re: Installer Check to see if it's an Intel Mac
  • Index(es):
    • Date
    • Thread