#!/bin/sh
#
# Check to make sure the computer is running 10.3 or later.

version=`uname -a | sed 's/.*Darwin Kernel Version \([0-9.]*\):.*/\1/'`
major=`echo $version | sed 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\1/'`
minor=`echo $version | sed 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\2/'`

if test $major -lt 7 -o $major -eq 7 -a $minor -lt 9
then
    # Warn and display message 16
    exit 112
fi

# Now check for libdap: first check that we can run the config script, then
# check the version that's installed.

if test -z "`dap-config --version 2> /dev/null`"
then
    # fail and display message 17
    exit 113
fi

version=`dap-config --version | sed 's/\([0-9.]*\) .*/\1/'`
major=`echo $version | sed 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\1/'`
minor=`echo $version | sed 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\2/'`

if test $major -lt 3 -o $major -eq 7 -a $minor -lt 7
then
    exit 113
fi

# Now check for bes: first check that we can run the config script, then
# check the version that's installed.

if test -z "`bes-config --version 2> /dev/null`"
then
    # bes does not need to be installed, so just exit
    exit 0
fi

version=`bes-config --version | sed 's/\([0-9.]*\) .*/\1/'`
major=`echo $version | sed 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\1/'`
minor=`echo $version | sed 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\2/'`

if test $major -lt 3 -o $major -eq 5 -a $minor -lt 1
then
    # fail and display message 18
    exit 114
fi

exit 0

