#!/sbin/sh
#------------------------------------------------------------------#
#
# HPUX_ID: @(#) $Revision: 17.3 $ generated on Wed Feb 21 17:19:34 MST 2001
#
# (c)Copyright 1983-2001 Hewlett-Packard Co.,  All Rights Reserved.
#
#------------------------------------------------------------------#
# SD postinstall script template for 11.X patches.                 #
#------------------------------------------------------------------#
# This file is optional for all 11.X patches.  The purpose of this #
# script is to prepare for a kernel build when required by the     #
# install conditions.  The script can also drive events that must  #
# occur before a system reboot occurs.                             #
#------------------------------------------------------------------#

_PATCHID=PHCO_23149

UTILS="/usr/lbin/sw/control_utils"

if [ ! -f $UTILS ]; then
    echo "ERROR:   Cannot find $UTILS"
    exit 1
fi

. $UTILS
exitval=$SUCCESS

#####
##### Insert any code you may require at this point in the script.
##### Pay attention to the exitval variable and set appropriately
##### in your code.  If you are unsure as to what types of operations
##### are legal in this file and what types aren't, consult the 
##### "Guidelines for SD Control Scripts" document.
#
#----------------------------------------------------------------------------
#-------------------------- Begin ESSD extended script ----------------------
#----------------------------------------------------------------------------
#
###############################################################################
# Make sure /var/opt/hparray directory exists and has the correct permissions

    # Don't remove old logfiles.

    if [[ -d ${SW_ROOT_DIRECTORY%/}/var/opt/hparray ]]
    then
      chmog 555 bin bin ${SW_ROOT_DIRECTORY%/}/var/opt/hparray
    fi

    if [[ -d ${SW_ROOT_DIRECTORY%/}/var/opt/hparray/log ]]
    then
      chmog 555 bin bin ${SW_ROOT_DIRECTORY%/}/var/opt/hparray/log
    fi

    if [[ -d ${SW_ROOT_DIRECTORY%/}/var/opt/hparray/admin ]]
    then
      chmog 775 root adm ${SW_ROOT_DIRECTORY%/}/var/opt/hparray/admin
    fi

    cond_mkdir 555 bin bin ${SW_ROOT_DIRECTORY%/}/var/opt
    cond_mkdir 555 bin bin ${SW_ROOT_DIRECTORY%/}/var/opt/hparray
    cond_mkdir 555 bin bin ${SW_ROOT_DIRECTORY%/}/var/opt/hparray/log
    cond_mkdir 775 root adm ${SW_ROOT_DIRECTORY%/}/var/opt/hparray/admin

###############################################################################
# Check to insure symbolic links exist for start/stop scripts 

   START=/sbin/rc2.d/S710hparamgr 
   KILL=/sbin/rc1.d/K290hparamgr

   if [[ ! -h $START ]]
   then
     ln -s /sbin/init.d/hparamgr $START
   fi

   if [[ ! -h $KILL ]]
   then
     ln -s /sbin/init.d/hparamgr $KILL
   fi

###############################################################################
#
#----------------------------------------------------------------------------
#------------------------ End ESSD extended script --------------------------
#----------------------------------------------------------------------------
#
#####
##### START_CUSTOMIZATION_HERE

exit $exitval
