Sunday, September 13, 2009

Testing for Machine Architecture

I little script to run if on PPC or Intel then do something....

_______ 8< snip ______________


#!/bin/sh

# check for hardware arch
type=`arch`
echo "Hardware Type is $type"

#Install appropriate package
# If result is Intel
if [ $type = "i386" ]; then
     # Put what you want to do here
     echo "You are running on Intel
else
# If PPC
     if [ $type = "ppc" ]; then
          # Put what you want to do here
          echo "You are runnin on PPC"
     fi
fi

# Always exit cleanly
exit 0