#!/bin/sh

#ident "$script: config-dlm Build 5.70.0.5 05/09/09 12:37:00 $"

#----------------------------------------------------------------------------#
# PRODUCT :  HDLM Driver 0501                                                #
#----------------------------------------------------------------------------#
# NAME :     config-dlm                                                      #
# FUNCTION : Configure HDLM devices during bootup                            #
# INSTANCE :                                                                 #
# MEMO :                                                                     #
# DATE :     2003/06/07                                                      #
# AUTHOR :   Bharvi Oak                                          	     #
# HISTORY :                                                                  #
#                                                                            #
#@ All Rights Reserved, Copyright (C) 2003,2005 Hitachi, Ltd.	             #
#----------------------------------------------------------------------------#

# REVAMP ACTIVITY PERFORMED. SO ALL PREVIOUS FDOCS & COMMENTS ARE REMOVED. PLEASE LOOKUP 
# PREVIOUS VERSIONS CODES FOR REFERENCE.

# This script is called from /etc/rc.d/rc.sysinit.
# This script will not run individually from command line
# because it requires a prior sourcing of /etc/rc.d/init.d/functions in the same shell.

if [ -f /etc/redhat-release ]; then
    if [ -f /etc/sysconfig/hdlm-scripts/common-defines ]; then
	    . /etc/sysconfig/hdlm-scripts/common-defines
    else
	    failure $"Attempting to source /etc/sysconfig/hdlm-scripts/common-defines: "
	    return
    fi
elif [ -f /etc/SuSE-release ]; then
    . /etc/rc.status
    rc_reset
    if [ -f /etc/sysconfig/hdlm-scripts/common-defines ]; then
	    . /etc/sysconfig/hdlm-scripts/common-defines
    else
            /bin/logger -t config-dlm "Attempting to source /etc/sysconfig/hdlm-scripts/common-defines:  failed"
	    rc_failed
	    rc_status 
	    return
        fi
fi

if [ -f /etc/redhat-release ]; then
  
    # DLMCFGMGR - HDLM Configuration steps start here for RedHat releases

    if $CMD_LSMOD | $CMD_GREP -q $FILTERDRV; then
	    export CFGMGR_FROM_SYSINIT=1
	    $CMD_ECHO -n $"Configuring HDLM devices: "
	    $DLMCfgMgr -r -s  > /dev/null 2>&1 && \
	    success $"Configuring HDLM devices: " || failure $"Configuring HDLM devices: "
	    $CMD_ECHO
	    unset CFGMGR_FROM_SYSINIT
    fi
    # DLMCFGMGR - HDLM Configuration steps end here for RedHat releases
else
    if [ -f /etc/SuSE-release ]; then
  
        # DLMCFGMGR - HDLM Configuration steps start here for SuSE releases
        if $CMD_LSMOD | $CMD_GREP -q $FILTERDRV; then
	        export CFGMGR_FROM_SYSINIT=1
	        $CMD_ECHO  $"Configuring HDLM devices: "  
            $DLMCfgMgr -r -s  > /dev/null 2>&1 && \
	        { /bin/logger -t config-dlm "Configuring HDLM devices:  succeeded"; rc_status; rc_status -v1; } || { /bin/logger -t config-dlm "Configuring HDLM devices:  failed"; rc_failed; rc_status -v1; } 
	        unset CFGMGR_FROM_SYSINIT
        fi
        # DLMCFGMGR - HDLM Configuration steps end here for SuSE releases
        rc_exit
    fi
fi
