Home | History | Annotate | Download | only in SUNWhxge
      1 #!/sbin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 #
     23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 
     27 set -u
     28 
     29 PATH="/usr/bin:/usr/sbin:${PATH}"
     30 export PATH
     31 
     32 # 
     33 # Driver info 
     34 # 
     35 DRV=hxge
     36 ARCH=`uname -p`
     37 if [ ${ARCH} = "i386" ]; then
     38     DRVALIAS=" \"pci108e,aaaa\" "
     39 fi
     40 
     41 if [ ${ARCH} = "sparc" ]; then
     42     DRVALIAS=" \"pciex108e,aaaa\" "
     43 fi
     44 
     45 DRVPERM='* 0600 root sys'
     46 # POLICY='read_priv_set=net_rawaccess write_priv_set=net_rawaccess'
     47 MAJORDEV=11
     48 
     49 #
     50 # Select the correct add_drv options to execute.
     51 #
     52 if [ "${BASEDIR}" = "/" ]; then
     53         #
     54         # Irrespective of whether hardware exists
     55         # or not don't attempt to attach driver
     56         # to the hardware. This is to avoid problems
     57         # with installing a 32 bit driver on a 64 bit
     58         # running system.
     59         #
     60         ADD_DRV="add_drv -n"
     61 else
     62         #
     63         # On a client,
     64         # modify the system files and touch/reconfigure
     65         # for reconfigure reboot
     66         #
     67         ADD_DRV="add_drv -b ${BASEDIR}"
     68 fi
     69 
     70 #
     71 # Make sure add_drv has *not* been previously executed
     72 # before attempting to add the driver.
     73 #
     74 grep -w "${DRV}" ${BASEDIR}/etc/name_to_major > /dev/null 2>&1
     75 if [ $? -eq 1 ]; then
     76         ${ADD_DRV} -m "${DRVPERM}" -i "${DRVALIAS}" ${DRV}
     77         if [ $? -ne 0 ]; then
     78                 echo "\nFailed add_drv!\n"
     79                 exit 1
     80         fi
     81 fi
     82 
     83 exit 0
     84