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 (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 #ident	"%Z%%M%	%I%	%E% SMI"
     24 #
     25 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     26 # Use is subject to license terms.
     27 #
     28 txtfile=/tmp/mailx-txt.$$
     29 scrfile=/tmp/mailx-scratch.$$
     30 
     31 export txtfile scrfile
     32 while read src dest
     33 do
     34 	if [ ! -f $dest ] ; then
     35 		cp $src $dest
     36 	else
     37 		#
     38 		# determine whether existing etc/mail/mailx.rc file is
     39 		# based on the same one being installed.  If so, no need
     40 		# to update it.
     41 		#
     42 		sed -n -e 's/^\([^#]*\).*$/\1/p' < $dest > $scrfile
     43 		#
     44 		# if either of the following is defined, no need to update.
     45 		#
     46 		if grep 'set[ 	][ 	]*appenddeadletter' $scrfile \
     47 		       >/dev/null 2>&1 || \
     48 		   grep 'set[ 	][ 	]*+pipeignore' $scrfile \
     49 		       >/dev/null 2>&1 ; then
     50 			:
     51 		else
     52 			#
     53 			# existing /etc/mail/mailx.rc file is based on
     54 			# the original installed version
     55 			#
     56 			(
     57 				cat <<EOF
     58 # The following 3 settings produce the familiar Solaris behavior.
     59 set appenddeadletter
     60 unset pipeignore
     61 unset replyall
     62 EOF
     63 				cat $dest
     64 			) > $txtfile
     65 			cp $txtfile $dest
     66 		fi
     67 	fi
     68 done
     69 rm -f $txtfile $scrfile
     70 exit 0
     71