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 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 # Use is subject to license terms. 24 # 25 # This is similar to i.preserve, except we also check if there is a file with 26 # the same name in the parent directory. 27 # 28 29 CLEANUP_FILE=/tmp/CLEANUP 30 REMOVEF=removef 31 errmsg1="Could not remove file, referenced by another package" 32 errmsg2="in.ftpd will use both %s and %s" 33 34 while read src dest; do 35 if [ ! -f $dest ]; then 36 # If the destination file does not exit, check the parent 37 # directory to see if it is there. 38 destfile=`basename $dest` 39 destdir=`dirname $dest` 40 parentfile=`dirname $destdir`/$destfile 41 if [ ! -f $parentfile ]; then 42 # If there is no parent file as well, we can use the 43 # file contained in the package. 44 cp $src $dest 45 else 46 # If there is a parent file, then we copy the contents 47 # to the destination, and then try to remove it from 48 # a previous package instance. 49 cp $parentfile $dest 50 $REMOVEF $PKGINST $parentfile 2> /dev/null \ 51 | xargs rm -f 52 if [ -f $parentfile ]; then 53 # If the parent file still exists, we need 54 # to log messages for the user. 55 printf "%s: $errmsg1\n" $parentfile \ 56 >> $CLEANUP_FILE 57 printf "%s: $errmsg2\n" $parentfile $dest \ 58 $parentfile >> $CLEANUP_FILE 59 fi 60 fi 61 fi 62 for user in dladm smmsp gdm webservd mysql openldap 63 do 64 egrep "^$user$|^#[ ]*$user$" $dest >/dev/null 2>&1 || \ 65 echo $user >> $dest 66 done 67 done 68 69 $REMOVEF -f $PKGINST > /dev/null 2>&1 70 exit 0 71