#!/bin/sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License, Version 1.0 only # (the "License"). You may not use this file except in compliance # with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # #ident "%Z%%M% %I% %E% SMI" # # Copyright (c) 2001 by Sun Microsystems, Inc. # All rights reserved. # PATH="/usr/bin:/usr/sbin:${PATH}" export PATH # During an upgrade this class action script merges user modifications in # the original ($dest) /etc/default/rpc.nisd into the new replacement # /etc/default/rpc.nisd ($src) file. # # If there is no existing default/rpc.nisd file, the script simply copies # the new default/rpc.nisd file into place. However, if there is an # existing default/rpc.nisd file, the script greps out each line which sets # a parameter in the original file and overwrites the corresponding line in # the new default/rpc.nisd file. # # The script works by looping through each variable name, grepping out the # apropos line, and creating a sed line, which when applied to the # replacement default/rpc.nisd file will preserve modifications in the # original default/rpc.nisd file. # while read src dest do if [ ! -f $dest ] ; then cp -p $src $dest else sedfile=/tmp/sftmp.$$ cat /dev/null > $sedfile for word in nisplusNumberOfServiceThreads \ nisplusMaxRPCRecordSize ENABLE_NIS_YP_EMULATION \ nisplusThreadCreationErrorAction \ nisplusThreadCreationErrorAttempts \ nisplusThreadCreationErrorTimeout nisplusDumpErrorAction \ nisplusDumpErrorAttempts nisplusDumpErrorTimeout \ nisplusResyncService nisplusUpdateBatching \ nisplusUpdateBatchingTimeout nisplusLDAPconfigDN \ nisplusLDAPconfigPreferredServerList \ nisplusLDAPconfigAuthenticationMethod nisplusLDAPconfigTLS \ nisplusLDAPconfigTLSCertificateDBPath \ nisplusLDAPconfigProxyUser nisplusLDAPconfigProxyPassword \ preferredServerList authenticationMethod defaultSearchBase \ nisplusLDAPbaseDomain nisplusLDAPTLS \ nisplusLDAPTLSCertificateDBPath nisplusLDAPproxyUser \ nisplusLDAPproxyPassword nisplusLDAPbindTimeout \ nisplusLDAPsearchTimeout nisplusLDAPmodifyTimeout \ nisplusLDAPaddTimeout nisplusLDAPdeleteTimeout \ nisplusLDAPsearchTimeLimit nisplusLDAPsearchSizeLimit \ nisplusLDAPfollowReferral nisplusLDAPinitialUpdateAction \ nisplusLDAPinitialUpdateOnly \ nisplusLDAPretrieveErrorAction \ nisplusLDAPretrieveErrorAttempts \ nisplusLDAPretrieveErrorTimeout \ nisplusLDAPstoreErrorAction nisplusLDAPstoreErrorAttempts \ nisplusLDAPstoreErrorTimeout nisplusLDAPrefreshErrorAction \ nisplusLDAPrefreshErrorAttempts \ nisplusLDAPrefreshErrorTimeout nisplusLDAPmatchFetchAction; do oldline1=`grep -i "^$word=" $dest | \ tail -1 2> /dev/null` oldline2=`grep -i "^#[ ]*$word=" $dest | \ tail -1 2> /dev/null` if [ -n "$oldline1" ]; then echo "s|^[# ]*$word=.*|$oldline1|" >> $sedfile elif [ -n "$oldline2" ]; then echo "s|^[# ]*$word=.*|$oldline2|" >> $sedfile fi done sed -f $sedfile $src > $dest rm -f $sedfile fi done exit 0