Listing 3

#!/bin/sh
#!/bin/sh
#
# $Header
# $Copyright
#
#
# root.sh
#
# This script is intended to be run by root.  The script contains
# all the product installation actions that require root privileges.
#
# IMPORTANT NOTES - READ BEFORE RUNNING SCRIPT
#
# (1) ORACLE_HOME and ORACLE_OWNER can be defined in user's
#     environment to override default values defined in this script.
#
# (2) The environment variable LBIN (defined within the script) points to
#     the default local bin area.  Three executables will be moved there as
#     part of this script execution.
#
# (3) Define (if desired) LOG variable to name of log file.
#

AWK=/usr/bin/awk
CAT=/bin/cat
CHGRP=/usr/bin/chgrp
CHOWN=/usr/sbin/chown
CHMOD=/bin/chmod
CP=/bin/cp
ECHO=/bin/echo
GREP=/usr/bin/grep
LBIN=/usr/local/bin
MKDIR=/bin/mkdir
ORATABLOC=/etc/oratab
ORATAB=${ORATABLOC}/oratab
RM=/bin/rm
SED=/usr/bin/sed
TEE=/usr/bin/tee
TMPORATB=/var/tmp/oratab$$

#
# If LOG is not set, then send output to /dev/null
#

if [ x${LOG} = x ] ;then
  LOG=/dev/null
else
  $CP $LOG ${LOG}0 2>/dev/null
  $ECHO "" > $LOG
fi

#
# Display abort message on interrupt.
#

trap '$ECHO "Oracle10 root.sh execution aborted!"|tee -a $LOG;exit' 1 2 3 15

#
# Enter log message
#

$ECHO "Running Oracle10 root.sh script..."|tee -a $LOG

#
# Default values set by Installer
#

ORACLE_HOME=/Users/oracle/10gEAR2/orahome
ORACLE_OWNER=oracle

#
# check for root
#

RUID=`/usr/bin/id|$AWK -F\( '{print $2}'|$AWK -F\) '{print $1}'`
if [ ${RUID} != "root" ];then
  $ECHO "You must be logged in as root to run root.sh."| $TEE -a $LOG
  $ECHO "Log in as root and restart root.sh execution."| $TEE -a $LOG
  exit 1
fi

#
# Determine how to suppress newline with $ECHO command.
#

case ${N}$C in
  "") if $ECHO "\c"| $GREP c >/dev/null 2>&1;then
        N='-n'
      else
        C='\c'
      fi;;
esac

#

$ECHO "\nThe following environment variables are set as:"| $TEE -a $LOG
$ECHO "    ORACLE_OWNER= $ORACLE_OWNER"| $TEE -a $LOG
$ECHO "    ORACLE_HOME=  $ORACLE_HOME"| $TEE -a $LOG

#
# Get name of local bin directory
#

$ECHO ""
$ECHO $N "Enter the full pathname of the local bin directory: $C"
DEFLT=${LBIN}; . $ORACLE_HOME/install/utl/read.sh; LBIN=$RDVAR
if [ ! -d $LBIN ];then
  $ECHO "Creating ${LBIN} directory..."| $TEE -a $LOG
  $MKDIR -p ${LBIN} 2>&1| $TEE -a $LOG
  $CHMOD 755 ${LBIN} 2>&1| $TEE -a $LOG
fi

#
# Move files to LBIN, and set permissions
#

DBHOME=$ORACLE_HOME/bin/dbhome
ORAENV=$ORACLE_HOME/bin/oraenv
CORAENV=$ORACLE_HOME/bin/coraenv
FILES="$DBHOME $ORAENV $CORAENV"

for f in $FILES ; do
  if [ -f $f ] ; then
    $CHMOD 755 $f  2>&1 2>> $LOG
    short_f=`$ECHO $f | $SED 's;.*/;;'`
    lbin_f=$LBIN/$short_f
    if [ -f $lbin_f ] ; then
      $ECHO $n "The file \"$short_f\" already exists in $LBIN.  Overwrite it? (y/n) $C"
      DEFLT='n'; . $ORACLE_HOME/install/utl/read.sh; OVERWRITE=$RDVAR	 
    else
      OVERWRITE='y'; 
    fi
    if [ "$OVERWRITE" = "y"  -o  "$OVERWRITE" = "Y" ] ; then
      $CP $f $LBIN  2>&1 2>>  $LOG
      $CHOWN $ORACLE_OWNER $LBIN/`$ECHO $f | $AWK -F/ '{print $NF}'` 2>&1 2>> $LOG
      $ECHO "   Copying $short_f to $LBIN ..."
    fi
  fi
done
$ECHO ""


#
# Make sure an oratab file exists on this system
#

if [ ! -s ${ORATAB} ];then
  $ECHO "\nCreating ${ORATAB} file..."| $TEE -a $LOG
  if [ ! -d ${ORATABLOC} ];then
    $MKDIR -p ${ORATABLOC}
  fi

  $CAT <<!>> ${ORATAB}
#



# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   \$ORACLE_SID:\$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same \$ORACLE_SID are not allowed.
#
#
!

fi

$CHOWN $ORACLE_OWNER ${ORATAB}
$CHMOD 664 ${ORATAB}

#
# If there is an old entry with no sid and same oracle home,
# that entry will be marked as a comment.
#

FOUND_OLD=`$GREP "^*:${ORACLE_HOME}:" ${ORATAB}`
if [ -n "${FOUND_OLD}" ];then
  $SED -e "s?^*:$ORACLE_HOME:?# *:$ORACLE_HOME:?" $ORATAB > $TMPORATB
  $CAT $TMPORATB > $ORATAB
  $RM -f $TMPORATB 2>/dev/null
fi

#
# Add generic *:$ORACLE_HOME:N to oratab
#

$ECHO "Adding entry to ${ORATAB} file..."| $TEE -a $LOG
$CAT <<!>> ${ORATAB}
*:$ORACLE_HOME:N
!

$ECHO "Entries will be added to the ${ORATAB} file as needed by"| $TEE -a $LOG
$ECHO "Database Configuration Assistant when a database is created"| $TEE -a $LOG

#
# Append the dbca temporary oratab entry to oratab
# In the case of ASM and RAC install, oratab is not yet created when root.sh
# is run, so we need to check for its existence before attempting to append it.
#
if [ -f $ORACLE_HOME/install/oratab ]
then
  $CAT $ORACLE_HOME/install/oratab >> $ORATAB
fi

#
#
# Change mode to remove group write permission on Oracle home
#

$CHMOD -R g-w $ORACLE_HOME

$ECHO "Finished running generic part of root.sh script."| $TEE -a $LOG
$ECHO "Now product-specific root actions will be performed."| $TEE -a $LOG



#!/bin/sh
#!/usr/bin/sh

# the following commands need to run as root after installing 
# the OEM Daemon

AWK=/usr/bin/awk
CAT=/usr/bin/cat
CHOWN="/usr/sbin/chown"
CHMOD="/bin/chmod"
CHMODR="/usr/bin/chmod -R"
CP=/bin/cp
ECHO=/bin/echo
MKDIR=/bin/mkdir
TEE=/usr/bin/tee
RM=/bin/rm
MV=/bin/mv
GREP=/usr/bin/grep
CUT=/bin/cut
SED=/usr/bin/sed

PLATFORM=`uname`

if [ ${PLATFORM} = "Linux" ] ; then
  CAT=/bin/cat
  CHOWN=/bin/chown
  CHMOD=/bin/chmod
  CHMODR="/bin/chmod -R"
  CP=/bin/cp
  ECHO=/bin/echo
  MKDIR=/bin/mkdir
  GREP=/bin/grep
  if [ ! -f $CUT ] ; then
     CUT=/usr/bin/cut
  fi
  SED=/bin/sed
fi


#
# If LOG is not set, then send output to /dev/null
#

if [ "x${LOG}" = "x" -o "${LOG}" = "" ];then
  LOG=/dev/null
else
  $CP $LOG ${LOG}0 2>/dev/null
  $ECHO "" > $LOG
fi

# Check to make certain this is being called as root
RUID=`/usr/bin/id|$AWK -F\( '{print $2}'|$AWK -F\) '{print $1}'`
if [ ${RUID} != "root" ];then
  $ECHO "You must be logged in as root to run root.sh."| $TEE -a $LOG
  $ECHO "Log in as root and restart root.sh execution."| $TEE -a $LOG
  exit 1
fi

# change owner and permissions of the remote operations executible
$CHOWN root $ORACLE_HOME/bin/nmo
$CHMOD 6750 $ORACLE_HOME/bin/nmo

# change owner and permissions of the program that does memory computations
$CHOWN root $ORACLE_HOME/bin/nmb
$CHMOD 6750 $ORACLE_HOME/bin/nmb

#change permissions on emdctl and emagent
$CHMOD 700 $ORACLE_HOME/bin/emagent
$CHMOD 700 $ORACLE_HOME/bin/emdctl

#
# Following changes to system executables are needed for getting
# host inventory metrics on HP-UX
#
if [ ${PLATFORM} = "HP-UX" ] ; then
  $CHMOD 555 /usr/sbin/swapinfo
  $CHMOD +r /dev/rdsk/*
fi
# The following commands need to be run before OCR is populated.
# This is run during single instance installation

ORACLE_USER=oracle
DBA_GROUP=oinstall
CHGRP=/usr/bin/chgrp

ORACLE_HOME=/Users/oracle/10gEAR2/orahome
OCRCONFIGDIR=/var/opt/oracle
OCRCONFIG=/var/opt/oracle/ocr.loc
OCRLOC=$ORACLE_HOME/cdata/localhost/local.ocr
INIT_CSS=TRUE
INIT_OCR=FALSE

if [ ! -d "$OCRCONFIGDIR" ];then
  $ECHO "$OCRCONFIGDIR does not exist. Creating it now."
  $MKDIR -p $OCRCONFIGDIR
fi

$CHOWN root $OCRCONFIGDIR
$CHGRP $DBA_GROUP $OCRCONFIGDIR
$CHMOD 755 $OCRCONFIGDIR

case `/usr/bin/uname` in
Linux)
	OCRCONFIGDIR=/etc/oracle
	OCRCONFIG=/etc/oracle/ocr.loc
	;;
HP-UX)
	OCRCONFIGDIR=/var/opt/oracle
	OCRCONFIG=/var/opt/oracle/ocr.loc
	;;
SunOS)
	OCRCONFIGDIR=/var/opt/oracle
	OCRCONFIG=/var/opt/oracle/ocr.loc
	;;
AIX)
	OCRCONFIGDIR=/etc/oracle
       OCRCONFIG=/etc/oracle/ocr.loc
       ;;
OSF1)
	OCRCONFIGDIR=/var/opt/oracle
       OCRCONFIG=/var/opt/oracle/ocr.loc
       ;;
*)
	OCRCONFIGDIR=/etc/oracle
       OCRCONFIG=/etc/oracle/ocr.loc
       ;;
esac

if [ ! -d "$OCRCONFIGDIR" ];then
  $ECHO "$OCRCONFIGDIR does not exist. Creating it now."
  $MKDIR -p $OCRCONFIGDIR 
  $CHOWN root $OCRCONFIGDIR
  $CHGRP $DBA_GROUP $OCRCONFIGDIR
  $CHMOD 755 $OCRCONFIGDIR
fi


if [ ! -f "$OCRCONFIG" ];then
  # ocr.loc does not exists, so we have to initialize OCR and single-node CSS
  INIT_OCR=TRUE
else
     # if ocr.loc file already exists, then performs the following:
     # a) check local_only flag to see multi-node CSS is in place
     # If yes, do not initialize CSS here. If no, continue
     # b) check the location of the OCR for existence
     # If does not exist, then  construct a new location and update ocr.loc
     # else continue
     LOCAL_FLAG=`$AWK -F= '/local_only/ {print $2}' < $OCRCONFIG`
     LOCAL_ONLY=`$ECHO $LOCAL_FLAG | $AWK '/[tT][rR][uU][eE]/ { print "TRUE" }'`
     # If OCR is configured for single node CSS -- if local_only=true
     if [ "$LOCAL_ONLY" = "TRUE" ];then

        CURR_OCRLOC=`$AWK -F= '/ocrconfig_loc/ {print $2}' < $OCRCONFIG`

        # ocrconfig_loc is specified with non-empty location
        if [ "$CURR_OCRLOC" != "" ]; then
            # ocrconfig_loc has a non empty location and
            # if that location exists
            if [ ! -f "$CURR_OCRLOC" ];then
              # Initialize/update OCR location
              INIT_OCR=TRUE
            fi
        else
            INIT_OCR=TRUE
        fi
     else # if local_only = FALSE
        # ocr.loc flag indicates that the multi-node CSS is already configured
        # So, we don't need to configure single node CSS here
        $ECHO "OCR is configured for Oracle Cluster Ready Services. CSS is already configured and should be running from Oracle Cluster Ready Services home"
        # This flag will be used later for checking whether to
        # initialize single-node CSS ot not
        INIT_CSS=FALSE
     fi
fi

# Check if we have to initialize and create a single node CSS
if [ "$INIT_CSS" = "TRUE" ]; then

  # Check if we have to create/update ocr.loc for single node CSS
  if [ "$INIT_OCR" = "TRUE" ]; then
     echo ocrconfig_loc=$OCRLOC > $OCRCONFIG
     echo local_only=TRUE >> $OCRCONFIG
     $CHOWN $ORACLE_OWNER $OCRCONFIG
     $CHGRP $DBA_GROUP $OCRCONFIG
     $CHMOD 644 $OCRCONFIG
  fi

  # check if cdata directory exists
  if [ ! -d "$ORACLE_HOME/cdata" ]; then
     $MKDIR $ORACLE_HOME/cdata
     $CHOWN $ORACLE_OWNER $ORACLE_HOME/cdata
     $CHGRP $DBA_GROUP $ORACLE_HOME/cdata
     $CHMOD 755 $ORACLE_HOME/cdata
  fi

  # Check if localhost dierctory under cdata exists
  if [ ! -d "$ORACLE_HOME/cdata/localhost" ]; then
     $MKDIR $ORACLE_HOME/cdata/localhost
     $CHOWN $ORACLE_OWNER $ORACLE_HOME/cdata/localhost
     $CHGRP $DBA_GROUP $ORACLE_HOME/cdata/localhost
     $CHMOD 755 $ORACLE_HOME/cdata/localhost
  fi

  if [ ! -f "$OCRLOC" ];then
    $CP /dev/null $OCRLOC
    $CHOWN $ORACLE_OWNER $OCRLOC
    $CHGRP $DBA_GROUP $OCRLOC
    $CHMOD 644 $OCRLOC
  fi

  $CHOWN $ORACLE_OWNER $OCRLOC
  $CHGRP $DBA_GROUP $OCRLOC
  $CHMOD 644 $OCRLOC
fi


#
# rootlocaladd.sbs for local CRS
#
#    This is run during the single instance database installation with
#    ASM support
#
if [ -z "$CHOWN" ]; then CHOWN=/bin/chown; fi
if [ -z "$CHMOD" ]; then CHMOD=/bin/chmod; fi
if [ -z "$ECHO" ]; then ECHO=/bin/echo; fi
if [ -z "$MKDIR" ]; then MKDIR=/bin/mkdir; fi
if [ -z "$PS" ]; then PSEF="/bin/ps -ef"; fi

HOSTNAME=/bin/hostname
MYHOSTNAME=`$HOSTNAME`

ORA_CRS_HOME=/Users/oracle/10gEAR2/orahome
CH=$ORA_CRS_HOME

ORACLE_HOME=$CH
export ORACLE_HOME
OH=$ORACLE_HOME

ORACLE_USER=oracle
CRSCTL=$CH/bin/crsctl

# Definitions to Add/Remove inittab entries

ADDITAB="$CAT \$IT | $GREP -v 'init\.cssd' > \$IT.no_cssd; \
         $CP \$IT.no_cssd \$IT; \
         $CAT \$IT $CH/css/admin/inittab_local > \$IT.cssd; \
         $ECHO \"Adding to inittab \" ; \
         $CP \$IT.cssd \$IT"
RMITAB="$CAT \$IT | $GREP -v 'init\.cssd' > \$IT.no_cssd; \
        $CP \$IT.no_cssd \$IT"

case `/usr/bin/uname` in
Linux) LD_LIBRARY_PATH=$ORA_CRS_HOME/lib
       DIRNAME=/usr/bin/dirname
       ID=/etc/init.d
       RCDIR="/etc/rc.d/rc2.d /etc/rc.d/rc3.d /etc/rc.d/rc5.d"
       RC_START=S96
       RC_KILL=K96
       IT=/etc/inittab
       INIT=/sbin/init
       export LD_LIBRARY_PATH
       SCRBASE=/etc/oracle/scls_scr
       ;;
HP-UX) MACH_HARDWARE=`/bin/uname -m`
       if [ "$MACH_HARDWARE" = "ia64" ]; then
          SO_EXT=so
          NMAPIDIR_64=/opt/nmapi/nmapi2/lib/hpux64
          NMAPIDIR_32=/opt/nmapi/nmapi2/lib/hpux32
       else
          so_EXT=sl
          NMAPIDIR_64=/opt/nmapi/nmapi2/lib/pa20_64
          NMAPIDIR_32=/opt/nmapi/nmapi2/lib
       fi 
       LD_LIBRARY_PATH=$ORA_CRS_HOME/lib:$NMAPIDIR_64:/usr/lib:$LD_LIBRARY_PATH
       SHLIB_PATH=$ORA_CRS_HOME/lib32:$NMAPIDIR_32:$SHLIB_PATH
       DIRNAME=/bin/dirname
       ID=/sbin/init.d
       RCDIR="/sbin/rc3.d"
       RC_START=S960
       RC_KILL=K960
       IT=/etc/inittab
       INIT=/sbin/init
       export LD_LIBRARY_PATH
       export SHLIB_PATH
       SCRBASE=/var/opt/oracle/scls_scr
       ;;
SunOS) case `/bin/uname -i` in
       i86pc)
         LD_LIBRARY_PATH=$ORA_CRS_HOME/lib:/opt/ORCLcluster/lib:/usr/lib:/usr/ucblib:$LD_LIBRARY_PATH
         export LD_LIBRARY_PATH
         ;;
       *)
         LD_LIBRARY_PATH=$ORA_CRS_HOME/lib32:/opt/ORCLcluster/lib:/usr/lib:/usr/ucblib:$LD_LIBRARY_PATH
         LD_LIBRARY_PATH_64=$ORA_CRS_HOME/lib:/opt/ORCLcluster/lib:/usr/lib:/usr/ucblib:$LD_LIBRARY_PATH_64
         export LD_LIBRARY_PATH
         export LD_LIBRARY_PATH_64
         ;;
       esac
       DIRNAME=/bin/dirname
       ID=/etc/init.d
       RCDIR="/etc/rc3.d"
       RC_START=S96
       RC_KILL=K96
       IT=/etc/inittab  
       INIT=/sbin/init
       SCRBASE=/var/opt/oracle/scls_scr
       ;;
AIX)   LIBPATH=$ORA_CRS_HOME/lib:$ORA_CRS_HOME/lib32:/usr/lib:$LIBPATH
       LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH
       DIRNAME=/bin/dirname
       ID=/etc
       RCDIR="/etc/rc.d/rc2.d"
       RC_START=S96
       RC_KILL=K96
       IT=/etc/inittab
       INIT=/usr/sbin/init
       ADDITAB="$ECHO \"Adding to inittab\"; \
                while read line ;\
                do \
                rflds=\`echo \$line | cut -d ':' -f 1-3\`; \
                lfld=\`echo \$line | cut -d ':' -f 4-\`; \
                mkitab \$rflds:\"\$lfld\"; \
                done < $CH/css/admin/inittab_local"
       RMITAB="while read line; \
                do \
                identifier=\`echo \$line | cut -d ':' -f 1\`; \
                rmitab \$identifier 2>/dev/null; \
                done < $CH/css/admin/inittab_local"   
       export LIBPATH
       export LD_LIBRARY_PATH
       SCRBASE=/etc/oracle/scls_scr
       ;;
OSF1)  LD_LIBRARY_PATH=$ORA_CRS_HOME/lib:/shlib:/usr/lib
       DIRNAME=/usr/bin/dirname
       ID=/sbin/init.d
       RCDIR="/sbin/rc3.d"
       RC_START=S96
       RC_KILL=K96
       IT=/etc/inittab
       INIT=/sbin/init
       export LD_LIBRARY_PATH
       SCRBASE=/var/opt/oracle/scls_scr
       ;;
*)     LD_LIBRARY_PATH=$ORA_CRS_HOME/lib:/usr/lib:/usr/ucblib:$LD_LIBRARY_PATH
       DIRNAME=/bin/dirname
       ID=/etc/init.d
       RCDIR="/etc/rc2.d"
       RC_START=S96
       RC_KILL=K96
       IT=/etc/inittab
       INIT=/usr/sbin/init
       export LD_LIBRARY_PATH
       SCRBASE=/etc/oracle/scls_scr
       ;;
esac

SCRDIR=$SCRBASE/$MYHOSTNAME

LS=/bin/ls
KILL=/bin/kill
SLEEP=/bin/sleep
LN=/bin/ln
LNS="/bin/ln -s"
CHMOD=/bin/chmod
CP=/bin/cp
RM=/bin/rm
CAT=/bin/cat
ECHO=/bin/echo

$CHMOD 644 $IT $IT.orig IT.no_cssd IT.cssd $IT.crs $IT.no_crs 2>/dev/null

# INIT_CSS will be set based on local_only flag in ocr.loc
# Single node CSS will not be initialized and configured if there is already
# a multi-node CSS configured and servicing all the CSS/CRS clients
if [ "$INIT_CSS" = "TRUE" ]; then


  #Create SCR Home dir, owned by root 755
  $MKDIR -p   $SCRDIR  
  $CHOWN root $SCRBASE 
  $CHOWN root $SCRDIR  
  $CHMOD 755  $SCRBASE 
  $CHMOD 755  $SCRDIR  


  # Initialize the system SCR settings
  $CRSCTL create scr $ORACLE_USER

  for d in css css/init css/log css/auth
  do
    $CHMOD 711 $CH/$d
  done

  # check directories above $CH are owned by root

  # Initialize the OCR repository the first time we come through the script.

  SCRIPT_STATUS=0
  CLSCFG=$CH/bin/clscfg

  $CLSCFG -local -o $CH -l "AMERICAN_AMERICA.WE8ISO8859P1"
  SCRIPT_STATUS=$?
  case $SCRIPT_STATUS in
    0) $ECHO "Oracle Cluster Registry for cluster has been initialized";;
  105) $ECHO "Oracle Cluster Registry for cluster has already been initialized";;
    *) $ECHO "Failed to initialize Oracle Cluster Registry for cluster";;
  esac

  if [ $SCRIPT_STATUS = 0 ];
  then

    OCSSDPID=`$PSEF | $GREP 'ocssd\.bin' | $GREP -v grep | $AWK '{print $2}'`
    if [ "$OCSSDPID" = "" ];
    then
       $ECHO ""
    elif [ "$INIT_OCR" = "TRUE" ]; then
       $ECHO "Stale CSS daemon is running... killing it now"

       $CP $IT $IT.orig
       eval $RMITAB 
       $INIT q

       $KILL -9 $OCSSDPID
    fi

    # basic copies first...
    $CP $CH/css/admin/init.cssd $ID/init.cssd

    for rc in $RCDIR
    do
      $RM -f $rc/"$RC_START"init.cssd $rc/"$RC_KILL"init.cssd
      $LNS $ID/init.cssd $rc/"$RC_START"init.cssd  || { $ECHO $?; exit 1; }
      $LNS $ID/init.cssd $rc/"$RC_KILL"init.cssd || { $ECHO $?; exit 1; }
    done

    $CP $IT $IT.orig
    eval $ADDITAB
    # Install CSS and start it up.
    $ID/init.cssd start
    $INIT q
  
    # Now wait for it to come up
    $ECHO "Checking the status of Oracle init process..."
    if $CRSCTL check install -wait 600 
    then
      $ECHO "Oracle CSS service is installed and running under init(1M)"    

    else	# problems, clean up.
      $ECHO "Giving up: Oracle CSS stack appears NOT to be running."
  
      for rc in $RCDIR
      do
       $RM -f $rc/"$RC_START"init.cssd $rc/"$RC_KILL"init.cssd
      done
  
      $ECHO "Oracle CSS service would not start as installed"
      $ECHO "Automatic Storage Management(ASM) cannot be used until Oracle CSS service is started"
    fi
  elif [ $SCRIPT_STATUS = 105 ]; 
  then
    CURR_OCRLOC=`$AWK -F= '/ocrconfig_loc/ {print $2}' < $OCRCONFIG`

    if [ "$CURR_OCRLOC" = "$OCRLOC" ];
    then
       OCSSDPID=`$PSEF | $GREP 'ocssd\.bin' | $GREP -v grep | $AWK '{print $2}'`
       if [ "$OCSSDPID" = "" ];
       then
          $CP $CH/css/admin/init.cssd $ID/init.cssd

          $ECHO "Starting Oracle CSS service under init(1M)"    
          $ID/init.cssd start
          $INIT q

          if $CRSCTL check install -wait 120 
          then
            $ECHO "Oracle CSS service is installed and running under init(1M)" 
          else
            $ECHO "Giving up: Oracle CSS stack appears NOT to be running."
          fi
       fi
    fi
  fi
fi
if [ -f $ORACLE_HOME/bin/oradism ]; then
	$CHOWN root $ORACLE_HOME/bin/oradism
	$CHMOD 06550 $ORACLE_HOME/bin/oradism
fi
if [ -f $ORACLE_HOME/bin/extjob ]; then
	$CHOWN nobody $ORACLE_HOME/bin/extjob
        $CHGRP nobody $ORACLE_HOME/bin/extjob
	$CHMOD 6711 $ORACLE_HOME/bin/extjob
fi
# The filemap binaries need to exist under /opt/ORCLfmap/prot1_X where
# X is either 32 for 32-bit Solaris machines and 64 for 64-bit Solaris
# machines.
#
# Other UNIX platforms will have to do something similar  

RM=/bin/rm
LN=/bin/ln
ORCLFMAPLOC=/opt/ORCLfmap
FILEMAPLOC=$ORCLFMAPLOC/prot1_32 # needs to be prot1_64 for 64 bit platforms

if [ ! -d $ORCLFMAPLOC ];then
$MKDIR $ORCLFMAPLOC
fi
if [ ! -d $FILEMAPLOC ];then
$MKDIR $FILEMAPLOC
fi
if [ ! -d $FILEMAPLOC/bin ];then
$MKDIR $FILEMAPLOC/bin
fi
if [ ! -d $FILEMAPLOC/etc ];then
$MKDIR $FILEMAPLOC/etc
fi
if [ ! -d $FILEMAPLOC/log ];then
$MKDIR $FILEMAPLOC/log
fi

$CP $ORACLE_HOME/bin/fmputl $FILEMAPLOC/bin
$CP $ORACLE_HOME/bin/fmputlhp $FILEMAPLOC/bin
$CHMOD 550 $FILEMAPLOC/bin/fmputl
$CHMOD 4555 $FILEMAPLOC/bin/fmputlhp
if [ ! -f $FILEMAPLOC/etc/filemap.ora ];then
$CP $ORACLE_HOME/rdbms/install/filemap.ora $FILEMAPLOC/etc
fi
# create the link from $ORACLE_HOME to $FILEMAPLOC
if [ -h $ORACLE_HOME/rdbms/filemap -o -f $ORACLE_HOME/rdbms/filemap ];then
$RM $ORACLE_HOME/rdbms/filemap
fi
if [ -d $ORACLE_HOME/rdbms/filemap ];then
$RM -rf $ORACLE_HOME/rdbms/filemap
fi
$LN -s $FILEMAPLOC $ORACLE_HOME/rdbms/filemap