OpenSolaris_b135/pkgdefs/common_files/i.sendmail

#!/bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (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
#
#
#ident	"%Z%%M%	%I%	%E% SMI"
#
# Copyright (c) 2000 by Sun Microsystems, Inc.
#
#
CLEANUP_FILE=/tmp/CLEANUP

#
# Sendmail 8.9 used the file names sendmail.cw and sendmail.ct, whereas 8.10
# uses local-host-names and trusted-users respectively (all in /etc/mail).
# So first check if the file exists by the new name; if so, do nothing.
# Then check the old name; if that exists, hard-link the old name and the
# new name.  If neither name exists, just install the default version.
#

handle() {
	if [ `basename $2` = $4 ] ; then
		OLDFILE="`dirname $2`/$3"
		if [ -f $2 ]; then
			return
		elif [ -f $OLDFILE ]; then
			ln $OLDFILE $2
			echo "EXISTING_FILE_RENAMED: $OLDFILE $2" \
				>> $CLEANUP_FILE
		else
			cp -p $1 $2
		fi
	fi
}

while read src dest
do
	if [ ! -f $dest ] ; then
		handle $src $dest "sendmail.cw" "local-host-names"
		handle $src $dest "sendmail.ct" "trusted-users"
	fi
done
exit 0