Home | History | Annotate | Download | only in SUNW1394
      1 #!/bin/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, Version 1.0 only
      7 # (the "License").  You may not use this file except in compliance
      8 # with the License.
      9 #
     10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     11 # or http://www.opensolaris.org/os/licensing.
     12 # See the License for the specific language governing permissions
     13 # and limitations under the License.
     14 #
     15 # When distributing Covered Code, include this CDDL HEADER in each
     16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     17 # If applicable, add the following below this CDDL HEADER, with the
     18 # fields enclosed by brackets "[]" replaced with your own identifying
     19 # information: Portions Copyright [yyyy] [name of copyright owner]
     20 #
     21 # CDDL HEADER END
     22 #
     23 
     24 # ident	"%Z%%M%	%I%	%E% SMI"
     25 # SUNW1394 postinstall script
     26 # Copyright 1999-2000,2003 Sun Microsystems, Inc.  All rights reserved.
     27 # Use is subject to license terms.
     28 #
     29 
     30 PATH="/usr/bin:/usr/sbin:${PATH}"
     31 export PATH
     32 
     33 # 
     34 # Driver info 
     35 # 
     36 DRV=hci1394
     37 DRVALIAS='pciclass,0c0010'
     38 DRVPERM='* 0600 root sys'
     39 
     40 #
     41 # Is the hardware there?
     42 #
     43 hw_exists=0
     44 prtconf -pv | egrep -s "${DRVALIAS}"
     45 if [ $? -eq 0 ]; then
     46 	hw_exists=1
     47 fi
     48 
     49 #
     50 # Select the correct add_drv options to execute.
     51 # Only attempt to attach the driver
     52 # on a running system with the hardware present.
     53 #
     54 if [ "${BASEDIR}" = "/" ]; then
     55 	#
     56 	# No need to add_drv if the running system is of a different arch
     57 	# than the package
     58 	#
     59 	karch=`uname -p`
     60 	if [ "${karch}" != "${ARCH}" ]; then
     61 		exit 0
     62 	fi
     63 	case ${hw_exists} in
     64 		#
     65 		# On a running system with *no* hardware,
     66 		# modify the system files only
     67 		#
     68 		0 )
     69 			ADD_DRV="add_drv -n"
     70 			;;
     71 		#
     72 		# On a running system with hardware,
     73 		# modify the system files and attach the driver
     74 		#
     75 		1 )
     76 			ADD_DRV="add_drv"
     77 			;;
     78 	esac
     79 else
     80 	#
     81 	# On a client,
     82 	# modify the system files and touch /reconfigure
     83 	# for reconfigure reboot
     84 	#
     85 	ADD_DRV="add_drv -b ${BASEDIR}"
     86 fi
     87 
     88 #
     89 # Make sure add_drv has *not* been previously executed
     90 # before attempting to add the driver.
     91 #
     92 grep "^${DRV} " $BASEDIR/etc/name_to_major > /dev/null 2>&1
     93 if [ $? -ne 0 ]; then
     94 	${ADD_DRV} -m "${DRVPERM}" -i "\"${DRVALIAS}\"" ${DRV}
     95 	if [ $? -ne 0 ]; then
     96 		echo "\nFailed add_drv of ${DRV}!\n" >&2
     97 		exit 1
     98 	fi
     99 fi
    100 
    101 exit 0
    102