#!/bin/bash

SRDIR=/opt/CPsrsc-50
RM=/bin/rm

# check kernel version
MAJOR=`uname -r | tr '.C[a-z]-' '   ' | awk '{print $1}'`
MINOR=`uname -r | tr '.C[a-z]-' '   ' | awk '{print $2}'`

if  [ "$MAJOR" < "9" ]; then
    echo  Unsupported kernel version. 
    exit 112
fi

# Check for previous installations
DIREXISTS=`ls -l $SRDIR | wc -l | awk '{print $1}'`
if [ "$DIREXISTS" -gt "0" ]; then
	echo  Please uninstall before installing.
    exit 113
fi

# return 112 = 1 2 4 8 16 32 64 128
#              0 0 0 0 1  1  1   0   = 112
# bits 5-6=1 - tells the installer to return user defined message
# bit 4=1 - tells the installer that the error message number is 16 (bits 0-4 determine message number)


exit 0

