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 2007 Sun Microsystems, Inc.  All rights reserved.
     26 # Use is subject to license terms.
     27 #
     28 
     29 add_driver() {
     30 	grep "^[ 	]*$1[ 	]" $dest > /dev/null 2>&1
     31 	if [ $? != 0 ] ; then
     32 		sed -e :a -e '/^\n*$/N;/\n$/ba' $dest > /tmp/x.$$
     33 		grep "^[ 	]*$1[ 	]" $src >> /tmp/x.$$
     34 		cp /tmp/x.$$ $dest
     35 		rm -f /tmp/x.$$
     36 	fi
     37 }
     38 
     39 add_driver_replace() {
     40 	sed -e "/^[ 	]*$1[ 	]/d" -e :a -e '/^\n*$/N;/\n$/ba' \
     41 		$dest > /tmp/x.$$
     42 	grep "^[ 	]*$1[ 	]" $src >> /tmp/x.$$
     43 	cp /tmp/x.$$ $dest
     44 	rm -f /tmp/x.$$
     45 }
     46 
     47 remove_driver() {
     48 	grep "^[ 	]*$1[ 	]" $dest > /dev/null 2>&1
     49 	if [ $? = 0 ] ; then
     50 		grep -v "^[ 	]*$1[ 	]" $dest > /tmp/x.$$
     51 		cp /tmp/x.$$ $dest
     52 		rm -f /tmp/x.$$
     53 	fi
     54 }
     55 
     56 while read src dest
     57 do
     58 	if [ ! -f $dest ] ; then
     59 		cp $src $dest
     60 	else
     61 		add_driver mcpzsa
     62 		remove_driver stc
     63 		grep '^[ 	]*ptsl[ 	][ 	]*0[ 	][ 	]*15[ 	]' \
     64 			$dest > /dev/null 2>&1
     65 		if [ $? = 0 ] ; then
     66 			sed "/^[ 	]*ptsl/s/15/47/" $dest > /tmp/x.$$
     67 			cp /tmp/x.$$ $dest
     68 			rm -f /tmp/x.$$
     69 		fi
     70 		add_driver xencons
     71 		add_driver_replace se
     72 		add_driver_replace su
     73 		add_driver usbser_edge
     74 		add_driver usbsacm
     75 		add_driver usbsprl
     76 		add_driver usbsksp
     77 		remove_driver rts
     78 		add_driver ipsecah
     79 		add_driver ipsecesp
     80 		add_driver_replace zs
     81 		add_driver cvc
     82 		add_driver sgcn
     83 		add_driver wc
     84 		add_driver qcn
     85 		remove_driver chanmux
     86 	fi
     87 done
     88 
     89 exit 0
     90