#! /bin/sh

# $Copyright:	$
# Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
# Sequent Computer Systems, Inc.   All rights reserved.
#  
# This software is furnished under a license and may be used
# only in accordance with the terms of that license and with the
# inclusion of the above copyright notice.   This software may not
# be provided or otherwise made available to, or used by, any
# other person.  No title to or ownership of the software is
# hereby transferred.

#ident	"$Header: :mkpublic 1.11 89/12/15 $"
#
#	Install Public Domain Software
#
TARGDIR=$PUBLIC_ROOT/usr/local
SRCDIR=${SRC:-$ROOT/usr/src}/public

# Make sure there really is work to be done in this view
#
if [ ! -d $SRCDIR ]
then
        exit 0
fi

if [ -f /dynix ]
then
chown=/etc/chown
else
chown=/bin/chown
fi
chgrp=/bin/chgrp
#
# Install all public software
#
echo "\nInstalling $SRCDIR into $TARGDIR:"
umask 022
if [ ! -d $TARGDIR ]
then
	rm -rf $TARGDIR
	mkdir $TARGDIR
fi
/bin/chmod 775 $PUBLIC_ROOT/usr $PUBLIC_ROOT/usr/local
$chown root $PUBLIC_ROOT/usr $PUBLIC_ROOT/usr/local
$chgrp 3 $PUBLIC_ROOT/usr $PUBLIC_ROOT/usr/local
(cd $SRCDIR; find . -print | cpio -pdm $TARGDIR)
find $TARGDIR -name '.ccsmark' -exec rm -f '{}' ';'
find $TARGDIR -exec $chown root '{}' ';'
find $TARGDIR -exec $chgrp 3 '{}' ';'
find $TARGDIR -type d -exec /bin/chmod 775 '{}' ';'
find $TARGDIR -type f -exec /bin/chmod 664 '{}' ';'
#
# all done
#
date
exit 0
