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