i.ftpusers revision 6ba597c56d749c61b4f783157f63196d7b2445f0
3321N/A#!/bin/sh
3321N/A#
3321N/A# CDDL HEADER START
3321N/A#
3321N/A# The contents of this file are subject to the terms of the
3321N/A# Common Development and Distribution License (the "License").
3321N/A# You may not use this file except in compliance with the License.
3321N/A#
3321N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3321N/A# or http://www.opensolaris.org/os/licensing.
3321N/A# See the License for the specific language governing permissions
3321N/A# and limitations under the License.
3321N/A#
3321N/A# When distributing Covered Code, include this CDDL HEADER in each
3321N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3321N/A# If applicable, add the following below this CDDL HEADER, with the
3321N/A# fields enclosed by brackets "[]" replaced with your own identifying
3321N/A# information: Portions Copyright [yyyy] [name of copyright owner]
3321N/A#
3321N/A# CDDL HEADER END
3321N/A#
3321N/A# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
3321N/A# Use is subject to license terms.
3321N/A#
3321N/A# This is similar to i.preserve, except we also check if there is a file with
3321N/A# the same name in the parent directory.
3321N/A#
3321N/A
3321N/ACLEANUP_FILE=/tmp/CLEANUP
3321N/AREMOVEF=removef
3321N/Aerrmsg1="Could not remove file, referenced by another package"
3321N/Aerrmsg2="in.ftpd will use both %s and %s"
3321N/A
3321N/Awhile read src dest; do
3321N/A if [ ! -f $dest ]; then
3321N/A # If the destination file does not exit, check the parent
3321N/A # directory to see if it is there.
3321N/A destfile=`basename $dest`
3321N/A destdir=`dirname $dest`
3321N/A parentfile=`dirname $destdir`/$destfile
3321N/A if [ ! -f $parentfile ]; then
3321N/A # If there is no parent file as well, we can use the
3321N/A # file contained in the package.
3321N/A cp $src $dest
3321N/A else
3321N/A # If there is a parent file, then we copy the contents
3321N/A # to the destination, and then try to remove it from
3321N/A # a previous package instance.
3321N/A cp $parentfile $dest
3321N/A $REMOVEF $PKGINST $parentfile 2> /dev/null \
3321N/A | xargs rm -f
3321N/A if [ -f $parentfile ]; then
3321N/A # If the parent file still exists, we need
3321N/A # to log messages for the user.
3321N/A printf "%s: $errmsg1\n" $parentfile \
3321N/A >> $CLEANUP_FILE
3321N/A printf "%s: $errmsg2\n" $parentfile $dest \
3321N/A $parentfile >> $CLEANUP_FILE
3321N/A fi
3321N/A fi
3321N/A fi
3321N/A for user in dladm netadm netcfg smmsp gdm webservd mysql openldap xvm
3321N/A do
3321N/A egrep "^$user$|^#[ ]*$user$" $dest >/dev/null 2>&1 || \
3321N/A echo $user >> $dest
3321N/A done
3321N/Adone
3321N/A
3321N/A$REMOVEF -f $PKGINST > /dev/null 2>&1
3321N/Aexit 0
3321N/A