#!/bin/sh

# validate architecture
#
if [ $(arch) != i386 ]
then 
  exit 112 # 16, 17, 18 or 19 
fi

# validate Mac OS X version

#Version=$(sw_vers | grep 'ProductVersion:' | grep -o '[0-9]*\.[0-9]*\.[0-9]*')
Version=$(sw_vers | sed -n 's/ProductVersion:\(.*\)/\1/p')

OSXVersion=${Version%%.*}
SubVersion=${Version#*.}
MjrVersion=${SubVersion%%.*}
MnrVersion=${SubVersion##*.}

if (( ${OSXVersion} == 10 ))
then
    case ${MjrVersion} in
        [2-3]*)
            exit 117 # 21
            ;;
        *)
            ;;
    esac
else
    exit 116 # 20
fi