#!/bin/sh
#!/usr/bin/sh
ORACLE_HOME=/oracle/EPP/11203
. $ORACLE_HOME/install/utl/rootmacro.sh

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

AWK=/usr/bin/awk
CAT=/usr/bin/cat
CHOWN="/usr/bin/chown"
CHMOD="/usr/bin/chmod"
CHMODR="/usr/bin/chmod -R"
CP=/usr/bin/cp
ECHO=/usr/bin/echo
MKDIR=/usr/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 [ ${PLATFORM} = "SunOS" ] ; then
   GREP=/usr/xpg4/bin/grep
fi

if [ ${PLATFORM} = "Darwin" ] ; then 
  CAT=/bin/cat 
  CHOWN="/usr/sbin/chown" 
  CHMOD="/bin/chmod" 
  CHMODR="/bin/chmod -R" 
  CP=/bin/cp 
  ECHO=/bin/echo 
  MKDIR=/bin/mkdir 
  CUT=/usr/bin/cut 
fi 


# change owner and permissions of the remote operations executible
if [ -f  ${ORACLE_HOME}/bin/nmo.0 ];
then
  $RM -f ${ORACLE_HOME}/bin/nmo
  $CP -p ${ORACLE_HOME}/bin/nmo.0 ${ORACLE_HOME}/bin/nmo
fi
$CHOWN root $ORACLE_HOME/bin/nmo
$CHMOD 4710 $ORACLE_HOME/bin/nmo

# change owner and permissions of the program that does memory computations
if [ -f  ${ORACLE_HOME}/bin/nmb.0 ];
then
  $RM -f ${ORACLE_HOME}/bin/nmb
  $CP -p ${ORACLE_HOME}/bin/nmb.0 ${ORACLE_HOME}/bin/nmb
fi
$CHOWN root $ORACLE_HOME/bin/nmb
$CHMOD 4710 $ORACLE_HOME/bin/nmb

# change owner and permissions of the storage metrics executible
if [ -f  ${ORACLE_HOME}/bin/nmhs.0 ];
then
  $RM -f ${ORACLE_HOME}/bin/nmhs
  $CP -p ${ORACLE_HOME}/bin/nmhs.0 ${ORACLE_HOME}/bin/nmhs
fi
$CHOWN root $ORACLE_HOME/bin/nmhs
$CHMOD 4710 $ORACLE_HOME/bin/nmhs

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

# change permissions so they are accessible by users from groups
# other than the agent user group.
$CHMOD 755 $ORACLE_HOME/bin
$CHMODR a+rX $ORACLE_HOME/lib
$CHMODR a+rX $ORACLE_HOME/perl
#$CHMODR a+rX $ORACLE_HOME/sysman/admin/scripts
$CHMODR a+rX $ORACLE_HOME/jdk
$CHMOD 755 $ORACLE_HOME/bin/nmocat

#
# 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

$ECHO "Finished product-specific root actions."| $TEE -a $LOG

