postinstall revision 0ba2cbe97e0678a691742f98d2532caed0a2c4aa
2N/A#! /usr/bin/sh
2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
2N/A
2N/A#
2N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2N/A# Use is subject to license terms.
2N/A#
2N/A# ident "%Z%%M% %I% %E% SMI"
2N/A#
2N/A
2N/A# Driver info
2N/ADRV=ath
2N/ADRVALIAS='"pci168c,13" "pci168c,1014" "pci168c,1a" "pci168c,1b"'
2N/A
2N/ABASEDIR=${BASEDIR:-/}
2N/A
2N/A# Function: check_add_drv()
2N/A#
2N/A# This function will check if add_drv has been executed.
2N/A# If not simply calls add_drv. Otherwise adds entries to
2N/A# driver_aliases, driver_classes and minor_perm if necessary.
2N/A# The syntax of this function is the same as add_drv.
2N/A
2N/Acheck_add_drv()
2N/A{
2N/A CMD="add_drv"
2N/A
2N/A ALIAS=""
2N/A ALIASDIR="${BASEDIR}"/etc/driver_aliases
2N/A while getopts i:b: opt 2>/dev/null; do
2N/A case "$opt" in
2N/A i) CMD="${CMD} -i ${OPTARG}"
2N/A ALIAS=`echo ${OPTARG} | /usr/bin/sed -e "s/'//g"`
2N/A ;;
2N/A b) if [ "${OPTARG}" != "/" ]; then
2N/A # On a client
2N/A # modify the sytem files and touch
2N/A # /reconfigure for reconfigure reboot
2N/A CMD="${CMD} -b \"${OPTARG}\""
2N/A fi
2N/A ;;
2N/A \?) echo "check_add_drv(): Unknown option $opt"
2N/A return
2N/A ;;
2N/A esac
2N/A done
2N/A shift `/usr/bin/expr ${OPTIND} - 1`
2N/A DRIVER=$1
2N/A CMD="${CMD} ${DRIVER}"
2N/A
2N/A # Make sure add_drv has not been previously executed
2N/A # before attempting to add the driver
2N/A /usr/bin/egrep -s "^${DRIVER}[ ]" "$BASEDIR"/etc/name_to_major
2N/A
2N/A if [ $? -ne 0 ]; then
2N/A eval ${CMD}
2N/A if [ $? -ne 0 ]; then
2N/A echo "Failed add_drv ${DRIVER}!\n" >&2
2N/A exit 1
2N/A fi
2N/A else
2N/A # Add driver entry if necessary
2N/A if [ -n "${ALIAS}" ]; then
2N/A for i in ${ALIAS}; do
2N/A /usr/bin/egrep -s "^${DRIVER}[ ]+$i" ${ALIASDIR}
if [ $? -ne 0 ]; then
echo "${DRIVER} $i" >> ${ALIASDIR}
fi
done
fi
fi
}
check_add_drv -b "${BASEDIR}" -i "'${DRVALIAS}'" ${DRV}