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