#!/bin/csh -f
#
# Main pre check script 
#return 1 ----> faild
#return 0 ----> success

set IKIT_DIR=`pwd`
set log=$IKIT_DIR/log/pre_checks_status_file.log
set info=$IKIT_DIR/log/pre_checks_info_file.log
set MAIN_PRODUCT=DPS

if ( ! -w /etc/passwd )  then 
       echo "Please run the pre-installation utility as root user."
       exit 1
endif
set os = `uname`
if ( "$os" == "Linux" ) then 
        csh -f precheck_lin.csh >& /dev/null 
	grep "FAULT" $log >& /dev/null
        if ( "$status" == "0" ) then
                echo "-------FAILED-------" >> $log 
                exit 1
        endif
        grep "WARNING" $log >& /dev/null
        if ( "$status" == "0" ) then
                  echo "-------completed with warnings-------" >> $log 
                  exit 0
        endif
        echo ""
        echo "-------completed successfully-------" >> $log
        exit 0
endif
if ( "$os" == "SunOS" ) then
        csh -f precheck_sun.csh >&/dev/null
	grep "FAULT" $log >& /dev/null
        if ( "$status" == "0" ) then
                 echo "-------FAILED-------" >> $log
                 exit 1
        endif
        grep "WARNING" $log >& /dev/null
        if ( "$status" == "0" ) then
                  echo "-------completed with warnings-------" >> $log
                  exit 0
        endif
        echo ""
        echo "-------completed successfully-------" >> $log
        exit 0
if ( "$os" == "AIX" ) then
        csh -f precheck_aix.csh >&/dev/null
        grep "FAULT" $log >& /dev/null
        if ( "$status" == "0" ) then
                 echo "-------FAILED-------" >> $log
                 exit 1
        endif
        grep "WARNING" $log >& /dev/null
        if ( "$status" == "0" ) then
                  echo "-------completed with warnings-------" >> $log
                  exit 0
        endif
        echo ""
        echo "-------completed successfully-------" >> $log
        exit 0
else
      echo "You can run the pre installation utility only in SunOS, RH Linux or AIX."
      exit 1
endif       
