#!/bin/sh
#
# newerOS - return true if the current OS is newer than the latest supported OS
#
#         newOS  $current_OS/version  $latest_supported_OS/version
#
# If OS_VERSION > $LATEST_SUPPORTED_OS_VERSION then echo 1

OS_VERSION=$1
LATEST_SUPPORTED_OS_VERSION=$2

# Remove -point_rel  found on some RedHat releases
# then change dot's to spaces

OS1=`echo $OS_VERSION | sed 's/-.*$//' | sed 's/\./ /g'`
OS2=`echo $LATEST_SUPPORTED_OS_VERSION | sed 's/-.*$//' | sed 's/\./ /g'`

while [ ! -z "$OS1" ]
do
	a1=`set $OS1; echo $1`		# get first component

	if [ -z "$OS2" ]
	then
	    b1=0
	else
	    b1=`set $OS2; echo $1`
	fi

#echo $a1 $b1 >> /tmp/fff

	if [ $a1 -gt $b1 ]
	then
	    echo 1
	    exit
	fi

	if [ $b1 -gt $a1 ]
	then
	    echo 0
	    exit
	fi

	OS1=`set $OS1; shift; echo $*`
	OS2=`set $OS2; shift; echo $*`
done

echo 0
