i.ibnexconf revision cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0
130N/A#!/bin/sh
130N/A#
130N/A# CDDL HEADER START
130N/A#
130N/A# The contents of this file are subject to the terms of the
130N/A# Common Development and Distribution License (the "License").
130N/A# You may not use this file except in compliance with the License.
130N/A#
130N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
130N/A# or http://www.opensolaris.org/os/licensing.
130N/A# See the License for the specific language governing permissions
130N/A# and limitations under the License.
130N/A#
130N/A# When distributing Covered Code, include this CDDL HEADER in each
130N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
130N/A# If applicable, add the following below this CDDL HEADER, with the
130N/A# fields enclosed by brackets "[]" replaced with your own identifying
130N/A# information: Portions Copyright [yyyy] [name of copyright owner]
130N/A#
130N/A# CDDL HEADER END
130N/A#
130N/A
130N/A#
130N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
130N/A# Use is subject to license terms.
130N/A#
130N/A#ident "%Z%%M% %I% %E% SMI"
130N/A
130N/APATH=/usr/bin:$PATH
135N/A
135N/A#
135N/A# The IB Nexus driver (ib(7d)), requires the following lines :
130N/A# name="ib" class="root";
130N/A# in /kernel/drv/ib.conf file.
130N/A#
130N/A# This script adds the required line and relevant comments,
130N/A# if the lines are not already present in the ib.conf file.
130N/A#
130N/A
130N/A#
130N/A# Search for the line containing
130N/A# name="ib" class="root";
130N/A# in ib.conf file. This returns 0 on a successful search.
130N/A#
130N/Asearch_ibconf()
130N/A{
130N/A TGT_IBCONFFILE=$1
130N/A
130N/A grep "$IB_SEARCH_STRING" $TGT_IBCONFFILE > /dev/null 2>&1
130N/A search_result=$?
130N/A return $search_result
130N/A}
130N/A
130N/A#
130N/A# Update ib.conf just adds the line containing :
130N/A# name="ib" class="root";
130N/A# and the adjoining comments in target ib.conf file.
130N/A#
130N/Aupdate_ibconf()
130N/A{
130N/A TGT_IBCONFFILE=$2
130N/A
130N/A echo $IB_STR1 >> $TGT_IBCONFFILE
130N/A echo $IB_STR2 >> $TGT_IBCONFFILE
130N/A echo $IB_STR3 >> $TGT_IBCONFFILE
130N/A}
130N/A
130N/A#
130N/A# Search Pattern and additional lines for ib.conf
130N/A#
130N/AIB_STR1="# The name and class property are required to indicate that IB nexus"
130N/AIB_STR2="# driver is a child of the root nexus driver. DO NOT DELETE LINE BELOW"
130N/AIB_STR3="name=\"ib\" class=\"root\";"
130N/AIB_SEARCH_STRING="^[ ]*name=\"ib\"[ ]*class=\"root\"[ ]*;"
130N/A
130N/Awhile read src dest; do
130N/A if [ -f $dest ]; then
130N/A #
130N/A # 1. Search the $dest file for relevant line
130N/A # 2. If search fails, add the required lines to $dest
130N/A #
130N/A search_ibconf $dest
130N/A if [ "$?" -ne 0 ]; then
130N/A update_ibconf $src $dest
130N/A fi
130N/A
130N/A else
130N/A #
130N/A # If no ib.conf file is present on the target system,
130N/A # just copy over the one from the package.
130N/A #
cp -p $src $dest
fi
done
exit 0