Home | History | Annotate | Download | only in common_files
      1 #!/bin/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, Version 1.0 only
      7 # (the "License").  You may not use this file except in compliance
      8 # with the License.
      9 #
     10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     11 # or http://www.opensolaris.org/os/licensing.
     12 # See the License for the specific language governing permissions
     13 # and limitations under the License.
     14 #
     15 # When distributing Covered Code, include this CDDL HEADER in each
     16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     17 # If applicable, add the following below this CDDL HEADER, with the
     18 # fields enclosed by brackets "[]" replaced with your own identifying
     19 # information: Portions Copyright [yyyy] [name of copyright owner]
     20 #
     21 # CDDL HEADER END
     22 #
     23 #
     24 #ident	"%Z%%M%	%I%	%E% SMI"
     25 #
     26 # Copyright (c) 2000 by Sun Microsystems, Inc.
     27 #
     28 #
     29 CLEANUP_FILE=/tmp/CLEANUP
     30 
     31 #
     32 # Sendmail 8.9 used the file names sendmail.cw and sendmail.ct, whereas 8.10
     33 # uses local-host-names and trusted-users respectively (all in /etc/mail).
     34 # So first check if the file exists by the new name; if so, do nothing.
     35 # Then check the old name; if that exists, hard-link the old name and the
     36 # new name.  If neither name exists, just install the default version.
     37 #
     38 
     39 handle() {
     40 	if [ `basename $2` = $4 ] ; then
     41 		OLDFILE="`dirname $2`/$3"
     42 		if [ -f $2 ]; then
     43 			return
     44 		elif [ -f $OLDFILE ]; then
     45 			ln $OLDFILE $2
     46 			echo "EXISTING_FILE_RENAMED: $OLDFILE $2" \
     47 				>> $CLEANUP_FILE
     48 		else
     49 			cp -p $1 $2
     50 		fi
     51 	fi
     52 }
     53 
     54 while read src dest
     55 do
     56 	if [ ! -f $dest ] ; then
     57 		handle $src $dest "sendmail.cw" "local-host-names"
     58 		handle $src $dest "sendmail.ct" "trusted-users"
     59 	fi
     60 done
     61 exit 0
     62