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 
     29 while read src dest
     30 do
     31 	if [ ! -f $dest ] ; then
     32 		cp $src $dest
     33 	else
     34 		# add USR Courier entry
     35 		grep '^usrv32-ec[ 	]' $dest > /dev/null 2>&1
     36 		if [ $? != 0 ] ; then
     37 			echo "" > /tmp/x.$$
     38 			sed -n '/#.*USR Courier/,/^usrv32-nec/p' $src >> \
     39 			   /tmp/x.$$
     40 
     41 			#
     42 			# add it after the hayes entry if it exists,
     43 			# otherwise add it at the end.
     44 			#
     45 			grep '^hayes[ 	]' $dest > /dev/null 2>&1
     46 			if [ $? = 0 ] ; then
     47 				sed "/^hayes[ 	]/r /tmp/x.$$" $dest > \
     48 				    /tmp/ex.$$
     49 				mv /tmp/ex.$$ $dest
     50 			else
     51 				cat /tmp/x.$$ >> $dest
     52 			fi
     53 		fi
     54 
     55 		# add Telebit T1600 entry
     56 		grep '^tb9600-ec[ 	]' $dest > /dev/null 2>&1
     57 		if [ $? != 0 ] ; then
     58 			echo "" > /tmp/x.$$
     59 			sed -n '/#.*Telebit T1600/,/^tb9600-nec/p' $src >> \
     60 			    /tmp/x.$$
     61 			grep '^tbfast[ 	]' $dest > /dev/null 2>&1
     62 
     63 			#
     64 			# add it after the tbfast entry if it exists,
     65 			# otherwise add it at the end.
     66 			#
     67 			if [ $? = 0 ] ; then
     68 				sed "/^tbfast/r /tmp/x.$$" $dest > \
     69 				    /tmp/ex.$$
     70 				mv /tmp/ex.$$ $dest
     71 			else
     72 				cat /tmp/x.$$ >> $dest
     73 			fi
     74 		fi
     75 
     76 		# update STTY of usrv32-ec
     77 		grep '^usrv32-ec[ 	]' $dest | grep 'STTY=' |
     78 			grep -v 'crtsxoff' > /dev/null 2>&1
     79 		if [ $? = 0 ] ; then
     80 			sed "/^usrv32-ec[ 	]/s/crtscts/crtscts,crtsxoff/" \
     81 				$dest > /tmp/x.$$
     82 			mv /tmp/x.$$ $dest
     83 		fi
     84 
     85 		# update STTY of usrv32-nec
     86 		grep '^usrv32-nec[ ]' $dest | grep 'STTY=' |
     87 			grep -v 'crtsxoff' > /dev/null 2>&1
     88 		if [ $? = 0 ] ; then
     89 			sed "/^usrv32-nec[ 	]/s/crtscts/crtscts,crtsxoff/" \
     90 				$dest > /tmp/x.$$
     91 			mv /tmp/x.$$ $dest
     92 		fi
     93 
     94 		# update STTY of tb9600-ec
     95 		grep '^tb9600-ec[ 	]' $dest | grep 'STTY=' |
     96 			grep -v 'crtsxoff' > /dev/null 2>&1
     97 		if [ $? = 0 ] ; then
     98 			sed "/^tb9600-ec[ 	]/s/crtscts/crtscts,crtsxoff/" \
     99 				 $dest > /tmp/x.$$
    100 			mv /tmp/x.$$ $dest
    101 		fi
    102 
    103 		# update STTY of tb9600-nec
    104 		grep '^tb9600-nec[ 	]' $dest | grep 'STTY=' |
    105 			grep -v 'crtsxoff' > /dev/null 2>&1
    106 		if [ $? = 0 ] ; then
    107 			sed "/^tb9600-nec[ 	]/s/crtscts/crtscts,crtsxoff/" \
    108 				 $dest > /tmp/x.$$
    109 			mv /tmp/x.$$ $dest
    110 		fi
    111 
    112 
    113 		rm -f /tmp/*.$$
    114 	fi
    115 done
    116 
    117 exit 0
    118