postinstall revision 30588217a56ff2c9137248fb2e5065c4f0101459
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# CDDL HEADER START
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# The contents of this file are subject to the terms of the
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# Common Development and Distribution License (the "License").
fcc9f7f86c2fa2ceb8a5c16dc934fea7fa6887f2Andreas Gustafsson# You may not use this file except in compliance with the License.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcc9f7f86c2fa2ceb8a5c16dc934fea7fa6887f2Andreas Gustafsson# or http://www.opensolaris.org/os/licensing.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# See the License for the specific language governing permissions
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# and limitations under the License.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# When distributing Covered Code, include this CDDL HEADER in each
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# If applicable, add the following below this CDDL HEADER, with the
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# fields enclosed by brackets "[]" replaced with your own identifying
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# information: Portions Copyright [yyyy] [name of copyright owner]
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# CDDL HEADER END
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# Use is subject to license terms.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# Function: check_add_drv()
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# This function will check if the module has an entry in etc/name_to_major
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# If not simply calls add_drv with the arguments given. If there is
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# such an entry in name_to_major file, it adds entries in driver_aliases
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# driver_classes and minor_perm if necessary.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# The syntax of this function is the same as add_drv.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce while getopts i:b:m:c:N opt
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce \?) echo "check_add_drv can not handle this option"
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce /usr/bin/grep "^$drvname[ ]" $BASEDIR/etc/name_to_major > /dev/null 2>&1
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce # entry already in name_to_major, add alias, class, minorperm
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce /usr/bin/egrep "^$drvname[ ]+$i" $BASEDIR/etc/driver_aliases>/dev/null 2>&1
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce if [ $? -ne 0 ]
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce /usr/bin/egrep "^$drvname[ ]+$class( | |$)" $BASEDIR/etc/driver_classes > /dev/null 2>&1
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce if [ $? -ne 0 ]
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce echo "$drvname\t$class" >> $BASEDIR/etc/driver_classes
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce /usr/bin/grep "^$drvname:" $BASEDIR/etc/minor_perm > /dev/null 2>&1
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce if [ $? -ne 0 ]
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Lucecheck_add_drv -b "${BASEDIR}" -i '"SUNW,sun4v-channel-devices"' cnex
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Lucecheck_add_drv -b "${BASEDIR}" -i '"SUNW,sun4v-domain-service"' vlds
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Lucecheck_add_drv -b "${BASEDIR}" -i '"SUNW,sun4v-console-concentrator"' vcc
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Lucecheck_add_drv -b "${BASEDIR}" -i '"SUNW,sun4v-disk"' vdc
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Lucecheck_add_drv -b "${BASEDIR}" -i '"SUNW,sun4v-disk-server"' vds
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Lucecheck_add_drv -b "${BASEDIR}" -i '"SUNW,sun4v-channel"' vldc
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Lucecheck_add_drv -b "${BASEDIR}" -i '"SUNW,sun4v-network"' vnet
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Lucecheck_add_drv -b "${BASEDIR}" -i '"SUNW,sun4v-network-switch"' vsw
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# The temporary file will be created by the preinstall script
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# if the drd service is being installed for the first time by
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# means of an upgrade. If the temporary file does not exist,
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# it is not necessary to take any action for drd.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luceif [ ! -f $TMPFILE ]; then
aeb8fffc841865c3336383eadfd9987332a03286Andreas Gustafsson# Update the upgrade script to enable the drd service on the
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# system if it is a sun4v machine.
fcc9f7f86c2fa2ceb8a5c16dc934fea7fa6887f2Andreas Gustafssoncat >> $BASEDIR/var/svc/profile/upgrade << \_ENABLE_DRD
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# Enable drd if running on a sun4v platform