#!/bin/bash
#
# Check for proper OS version for the package (meant to be used by the
# MacPorts port which replaces 10 with the version of Darwin
# needed).

# error out if uname or sed can't be found
if ! which uname > /dev/null || ! which sed > /dev/null; then
    # message 16 in InstallationCheck.strings
    exit 112
fi

if ! [[ -x /usr/bin/xcodebuild ]]; then
    # message 17
    exit 113
fi

base_version=`uname -r | sed 's/\..*//'`
if [[ ${base_version} != 10 ]]; then
   # This maps to message 18 in InstallationCheck.strings (Apple allows
   # 16-31 for custom messages); that message should also be customized
   # like this script
   exit 114
fi

if [[ -f /opt/local/etc/ports/dp_version ]]; then
   # message 19 in InstallationCheck.strings
   exit 115
fi

exit 0
