xref: /titanic_50/usr/src/cmd/dodatadm/dodatadm.udaplt (revision b76c14595f2dd8b4765b40057467eb8796111fde)
1*b76c1459SBill Taylor#!/sbin/sh
2*b76c1459SBill Taylor#
3*b76c1459SBill Taylor# CDDL HEADER START
4*b76c1459SBill Taylor#
5*b76c1459SBill Taylor# The contents of this file are subject to the terms of the
6*b76c1459SBill Taylor# Common Development and Distribution License (the "License").
7*b76c1459SBill Taylor# You may not use this file except in compliance with the License.
8*b76c1459SBill Taylor#
9*b76c1459SBill Taylor# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*b76c1459SBill Taylor# or http://www.opensolaris.org/os/licensing.
11*b76c1459SBill Taylor# See the License for the specific language governing permissions
12*b76c1459SBill Taylor# and limitations under the License.
13*b76c1459SBill Taylor#
14*b76c1459SBill Taylor# When distributing Covered Code, include this CDDL HEADER in each
15*b76c1459SBill Taylor# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*b76c1459SBill Taylor# If applicable, add the following below this CDDL HEADER, with the
17*b76c1459SBill Taylor# fields enclosed by brackets "[]" replaced with your own identifying
18*b76c1459SBill Taylor# information: Portions Copyright [yyyy] [name of copyright owner]
19*b76c1459SBill Taylor#
20*b76c1459SBill Taylor# CDDL HEADER END
21*b76c1459SBill Taylor#
22*b76c1459SBill Taylor#
23*b76c1459SBill Taylor# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*b76c1459SBill Taylor# Use is subject to license terms.
25*b76c1459SBill Taylor#
26*b76c1459SBill Taylor
27*b76c1459SBill Taylor# First read the /etc/dat/dat.conf file to see if it has already been
28*b76c1459SBill Taylor# populated by the service provider entry. If so, simply return. If not,
29*b76c1459SBill Taylor# run datadm to populate the dat.conf file
30*b76c1459SBill Taylorif [ -r /etc/dat/dat.conf ]; then
31*b76c1459SBill Taylor	pattern="driver_name="
32*b76c1459SBill Taylor	[ `/usr/bin/grep -c "$pattern" /etc/dat/dat.conf` -ge 1 ] && exit 0
33*b76c1459SBill Taylorelse
34*b76c1459SBill Taylor	echo "WARNING: /etc/dat/dat.conf is missing or unreadable" >& 2
35*b76c1459SBill Taylor	exit 1
36*b76c1459SBill Taylorfi
37*b76c1459SBill Taylor
38*b76c1459SBill Taylor# Now /etc/dat/dat.conf is readable but does not contain an entry for the
39*b76c1459SBill Taylor# service provider. So, run datadm -a /usr/share/dat/SUNWudaplt.conf to
40*b76c1459SBill Taylor# populate dat.conf
41*b76c1459SBill Taylorif [ -x /usr/sbin/datadm ]; then
42*b76c1459SBill Taylor	if [ -r /usr/share/dat/SUNWudaplt.conf ]; then
43*b76c1459SBill Taylor		/usr/sbin/datadm -a /usr/share/dat/SUNWudaplt.conf
44*b76c1459SBill Taylor	else
45*b76c1459SBill Taylor		echo "WARNING: SUNWudaplt.conf is missing or unreadable" >& 2
46*b76c1459SBill Taylor		exit 1
47*b76c1459SBill Taylor	fi
48*b76c1459SBill Taylorelse
49*b76c1459SBill Taylor	echo "WARNING: /usr/sbin/datadm is missing or not executable" >& 2
50*b76c1459SBill Taylor	exit 1
51*b76c1459SBill Taylorfi
52