OpenSolaris_b135/pkgdefs/common_files/i.etcrpc

#!/bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH

while read src dest
do
	if [ ! -f $dest ] ; then
		cp $src $dest
	else
		# Add the entry for nispasswd used by rpc.nispasswdd.
		# We do not get fancy and try to add it at the "right"
		# location.  Putting it on the end works just fine.

		grep 'nispasswd' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'nispasswd	100303	rpc.nispasswdd' >> $dest
		fi

		# Add solstice admind entry
 		grep '100087' $dest > /dev/null 2>&1
 		if [ $? -eq 0 ] ; then

			sed 's/.*100087.*/sadmind		100232/' $dest > /tmp/r.$$
			cp /tmp/r.$$ $dest
			rm -f /tmp/r.$$
		fi

		# Add nfs_acl entry
		grep 'nfs_acl' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'nfs_acl		100227' >> $dest
		fi

		# Delete beta ufsd entry
		grep 'ufsd[ 	]*100999[ 	]*ufsd' $dest >/dev/null 2>&1
		if [ $? -eq 0 ] ; then
			grep -v 'ufsd[ 	]*100999[ 	]*ufsd' $dest \
					 >/tmp/etcrpc.$$ 2>/dev/null
			cp /tmp/etcrpc.$$ $dest
			rm -f /tmp/etcrpc.$$
		fi

		# Add ufsd entry
		grep 'ufsd' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'ufsd		100233	ufsd' >> $dest
		fi

		# Delete amiserv entry
		grep 'amiserv[	]*100146' $dest >/dev/null 2>&1
		if [ $? -eq 0 ] ; then
			grep -v 'amiserv[	]*100146' $dest \
					>/tmp/etcrpc.$$ 2>/dev/null
			cp /tmp/etcrpc.$$ $dest
			rm -f /tmp/etcrpc.$$
		fi

		# Delete amiaux entry
		grep 'amiaux[	]*100147' $dest >/dev/null 2>&1
		if [ $? -eq 0 ] ; then
			grep -v 'amiaux[	]*100147' $dest \
					>/tmp/etcrpc.$$ 2>/dev/null
			cp /tmp/etcrpc.$$ $dest
			rm -f /tmp/etcrpc.$$
		fi	

		# Delete ocfserv entry
		grep 'ocfserv[	]*100150' $dest >/dev/null 2>&1
		if [ $? -eq 0 ] ; then
			grep -v 'ocfserv[	]*100150' $dest \
					>/tmp/etcrpc.$$ 2>/dev/null
			cp /tmp/etcrpc.$$ $dest
			rm -f /tmp/etcrpc.$$
		fi	

		# Add metad entry
		grep 'metad' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'metad	100229 metad' >> $dest
		fi

		# Add metamhd entry
		grep 'metamhd' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'metamhd	100230 metamhd' >> $dest
		fi

		# Add metamedd entry
		grep 'metamedd' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'metamedd	100242 metamedd' >> $dest
		fi

		# Add smserverd entry
		grep 'smserverd' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'smserverd 100155 smserverd' >> $dest
		fi

		# Add gssd entry
		grep 'gssd' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'gssd	100234' >> $dest
		fi

		# Add ktkt_warnd entry
		grep 'ktkt_warnd' $dest > /dev/null 2>&1
		if [ $? -ne 0 ] ; then
			echo 'ktkt_warnd	100134' >> $dest
		fi

	fi
done

exit 0