#!/bin/sh

# Panther (10.3) or Tiger (10.4) or later are ok
if [ -x /usr/bin/sw_vers ]; then
  OSVERS=`/usr/bin/sw_vers | grep ^ProductVersion | awk -F' ' '{ print $2 }'`
  case $OSVERS in
     10.[012])   
                 exit 112
                 ;;
     10.[012].*) 
                 exit 112
                 ;;
     *)
                 ;;
  esac
else 
  exit 112
fi

# next make sure have Apple's X11 or XDarwin installed

if [ -d /Applications/Utilities/X11.app ]; then
  :
else
   if [ -d /Applications/XDarwin.app ]; then
      :
   else
     APPPOS=`locate X11.app/Contents/MacOS/X11 | sed -e 's-/Contents/MacOS/X11--g'`
     if [ "${APPPOS}X" != "X" ]; then
        :
     else
         APPPOS=`locate XDarwin.app/Contents/MacOS/XDarwin | sed -e 's-/Contents/MacOS/XDarwin--g'`
         if [ "${APPPOS}X" != "X" ]; then
            :
         else
            exit 113            
         fi
     fi
   fi
fi

# all is fine
exit 0
