#!/sbin/sh
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)postinstall	1.1	09/05/19 SMI"
#

PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH

# 
# Driver info 
# 
DRV=hxge
ARCH=`uname -p`
DRVALIAS=" \"pci108e,aaaa\" \"pciex108e,aaaa\""
DRVPERM='* 0600 root sys'
# POLICY='read_priv_set=net_rawaccess write_priv_set=net_rawaccess'
MAJORDEV=11

#
# Select the correct add_drv options to execute.
#
if [ "${BASEDIR}" = "/" ]; then
        #
        # Irrespective of whether hardware exists or not don't attempt to
        # attach driver to the hardware. The driver will be attached when
        # it is configured using ifconfig
        #
        ADD_DRV="add_drv -n"
else
        #
        # On a client,
        # modify the system files and touch/reconfigure
        # for reconfigure reboot
        #
        ADD_DRV="add_drv -b ${BASEDIR}"
fi

#
# Make sure add_drv has *not* been previously executed
# before attempting to add the driver.
#
grep -w "${DRV}" ${BASEDIR}/etc/name_to_major > /dev/null 2>&1
if [ $? -eq 1 ]; then
        ${ADD_DRV} -m "${DRVPERM}" -i "${DRVALIAS}" ${DRV}
        if [ $? -ne 0 ]; then
                echo "\nFailed add_drv!\n"
        fi
fi

exit 0
