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) 1994,1999 by Sun Microsystems, Inc.
     27 #
     28 
     29 #
     30 # Write a sed script to enable the use of RPC and NFS over IPv6 and
     31 # remove the various comments that were in /etc/netconfig when the
     32 # the respective entries were disabled.
     33 #
     34 write_sed_script() {
     35 cat > /tmp/netconfig.scr.$$ << EOF
     36 /^# The following two entries starting with udp6 and tcp6 are meant to be $/d
     37 /^# used for IPv6. If you have Ipv6 enabled on your machine then you can $/d
     38 /^# uncomment these two lines to enable RPC and NFS use Ipv6 stack. Consult$/d
     39 /^# uncomment these two lines to enable the use of RPC and NFS over IPv6.$/d
     40 /^# your network administrator before uncommenting. $/d
     41 /^# Consult your network administrator before uncommenting. $/d
     42 /^#udp6[ 	]*tpi_clts[ 	]*v[ 	]*inet6[ 	]*udp[ 	]*\/dev\/udp6[ 	]*-/s/#//
     43 /^#tcp6[ 	]*tpi_cots_ord[ 	]*v[ 	]*inet6[ 	]*tcp[ 	]*\/dev\/tcp6[ 	]*-/s/#//
     44 EOF
     45 }
     46 
     47 while read src dest
     48 do
     49 	if [ ! -f $dest ] ; then
     50 		cp $src $dest
     51 	else
     52 		grep 'switch.so' $dest > /dev/null 2>&1
     53 		if [ $? = 0 ] ; then
     54 			cp $src $dest
     55 		fi
     56 		grep 'If you have Ipv6 enabled on your' $dest > /dev/null 2>&1
     57 		if [ $? = 0 ] ; then
     58 			write_sed_script
     59 			sed -f /tmp/netconfig.scr.$$ $dest > /tmp/netconfig.$$
     60 			cp /tmp/netconfig.$$ $dest
     61 			rm -f /tmp/netconfig.$$ /tmp/netconfig.scr.$$
     62 		fi
     63 		grep 'inet6' $dest > /dev/null 2>&1
     64 		if [ $? != 0 ] ; then
     65 			grep '^#' $dest >/tmp/netconfig.$$
     66 			grep 'inet6' $src >>/tmp/netconfig.$$
     67 			grep '^[^#]' $dest >>/tmp/netconfig.$$
     68 			cp /tmp/netconfig.$$ $dest
     69 			rm -f /tmp/netconfig.$$
     70 		fi
     71 	fi
     72 done
     73 
     74 exit 0
     75