#!/bin/sh
# checkinstall
# $Id: checkinstall,v 1.1 2000/03/18 21:01:36 gwiley Exp $
# Glen Wiley, <gwiley@ieee.org>
#
# feed this script to the pkg mechanism under Solaris to confirm
# a minimum OS version
#
# the required major and minor OS versions should be specified in
# REQOSMAJ and REQOSMIN, REQOSMIN will default to 0
# this script will exit with 0 if the OS meets the minimum version
# requirements otherwise it exits with 3 (stops pkgadd)
#
# if REQOSVER is set then the major and minor version nums will be
# derived from that

if [ ! -z "$REQOSVER" ]
then
	oifs="$IFS"
	IFS="."
	set -- $REQOSVER
	REQOSMAJ="$1"
	REQOSMIN="$1"
	IFS="$oifs"
fi

if [ -z "$REQOSMAJ" ]
then
	exit 0
fi
REQOSMIN=${REQOSMIN:-0}

oifs="$IFS"
IFS="."
set -- `uname -r`
IFS="$oifs"
osmaj="$1"
osmin="$2"

res=`expr $REQOSMAJ \<= $osmaj`
if [ "$res" = "0" ]
then
	printf "\nthis package requires SunOS $REQOSMAJ.$REQOSMIN or later\n\n"
	exit 3
fi

res=`expr $REQOSMIN \<= $osmin`
if [ "$res" = "0" ]
then
	printf "\nthis package requires SunOS $REQOSMAJ.$REQOSMIN or later\n\n"
	exit 3
fi

exit 0

# checkinstall
