#!/bin/sh

# Creates two gzipped tar files of tops:
#   1.  tops.tgz           (expands to tops/)
#   2.  tops-X.Y.Z.tgz     (expands to tops-X.Y.Z/)
# neither of which have CVS subdirectories.

MD=/opt/tops       # The CVS tree which is to be tarred.  Also the location
                   # where the two .tgz files will be written.
VERSION=3.0.1      # Version number to label the tar file & tops directory.
TEMPDIR=/tmp       # Location for work area.
TOPSVER=tops-${VERSION}

cd $MD

rm -fr $TEMPDIR/tops   # get rid of old one if it exists
cp -pr $MD $TEMPDIR
# get rid of core files, the tops executable, and the make.inc link (or file)
find $TEMPDIR/tops -name core -name tops -name make.inc | xargs rm -f

# create tops.tgz       which expands into tops/
#
cd $TEMPDIR
tar czvf tops.tgz tops --exclude CVS
mv tops.tgz $MD

rm -fr  $TOPSVER   # get rid of old one if it exists
mv tops $TOPSVER   # for example, rename /tmp/tops to /tmp/tops-2.4.1

# create tops-X.Y.Z.tgz which expands into tops-X.Y.Z/
#
tar czvf $TOPSVER.tgz $TOPSVER --exclude CVS
mv $TOPSVER.tgz $MD
rm -fr   $TOPSVER  # no longer need the working directory
