Home | History | Annotate | Download | only in SUNWnxge
      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 # ident	"%Z%%M%	%I%	%E% SMI"
     27 #
     28 
     29 set -u
     30 
     31 PATH="/usr/bin:/usr/sbin:${PATH}"
     32 export PATH
     33 
     34 # 
     35 # Driver info 
     36 # 
     37 DRV=nxge
     38 DRVALIAS=" \"pciex108e,abcd\" \"SUNW,niusl\""
     39 
     40 DRVPERM='* 0600 root sys'
     41 # POLICY='read_priv_set=net_rawaccess write_priv_set=net_rawaccess'
     42 MAJORDEV=11
     43 
     44 #
     45 # Select the correct add_drv options to execute.
     46 #
     47 if [ "${BASEDIR}" = "/" ]; then
     48         #
     49         # Irrespective of whether hardware exists
     50         # or not don't attempt to attach driver
     51         # to the hardware. This is to avoid problems
     52         # with installing a 32 bit driver on a 64 bit
     53         # running system.
     54         #
     55         ADD_DRV="add_drv -n"
     56 else
     57         #
     58         # On a client,
     59         # modify the system files and touch/reconfigure
     60         # for reconfigure reboot
     61         #
     62         ADD_DRV="add_drv -b ${BASEDIR}"
     63 fi
     64 
     65 removef $PKGINST /platform/i86pc/kernel/drv/nxge.conf >/dev/null 2>&1
     66 removef -f $PKGINST >/dev/null 2>&1
     67 
     68 #
     69 # Make sure add_drv has *not* been previously executed
     70 # before attempting to add the driver.
     71 #
     72 grep -w "${DRV}" ${BASEDIR}/etc/name_to_major > /dev/null 2>&1
     73 if [ $? -eq 1 ]; then
     74         ${ADD_DRV} -m "${DRVPERM}" -i "${DRVALIAS}" ${DRV}
     75         if [ $? -ne 0 ]; then
     76                 echo "\nFailed add_drv!\n" >&2
     77                 exit 1
     78         fi
     79 fi
     80 
     81 exit 0
     82