#!/bin/sh
#
# Get/print os release, major, minor and subminor
#

cmd=$(basename $0)

if [ $# -ne 1 ]
then
   echo -e "$cmd -- ERROR: no output file specified\n" >&2
   exit 1
fi

OS_Release=`uname -r`
OS_Major=`echo $OS_Release | sed 's!\..*\..*$!!'`
OS_Minor=`echo $OS_Release | sed 's!^..*\.\(..*\)\..*$!\1!'`
OS_SubMinor=`echo $OS_Release | sed 's!^..*\...*\.\(..*\)$!\1!'`

echo -e "OS_Major = ${OS_Major}\n"\
        "OS_Minor = ${OS_Minor}\n"\
        "OS_SubMinor = ${OS_SubMinor}\n"\
        "OS_Release = ${OS_Release}" > $1

exit 0
