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