1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
  
     | 
    
      #!/bin/ksh
# exportit -- a simple little script to export something from a
# CVS repository and create a "release" tarbal of it, in mostly
# automated fasion.  Could probably stand do more error
# checking, but if things are happy, it works.  :-)  Note that
# people getting this with ttyload will have no reason to use it
# in conjunction with ttyload.
# Copyright 2001 by David Lindes, All Rights Reserved.
# Distributed under the license described in the file LICENSE
# that comes with ttyload.
# if you're wanting to use this script for some other project,
# and you want to call your release something other than the
# name of the directory above this one (.., but by name), change
# the "false" below to "true", and the "xyzprod" to whatever you
# want to call things.  Note that your tagging will have to also
# be changed appropriately.
if false
then
    # override the name of what to call stuff:
    name="xyzprod"
else
    # make sure name is unset, so that the ${name:-blah}
    # expansion below doesn't get stuff from your environment
    # accidentally
    unset name
fi
# automagical settings for things:
path="`cat CVS/Repository`"
root="`cat CVS/Root`"
localroot="${root##*:}"
localpath="${path##${localroot}/}"
name="${name:-`basename "$path"`}"
version="`cat Version`"
cvsvers="${name}_`echo \"$version\" | sed -e 's/[ \.]/_/g'`"
dirname="$name-$version"
for item in "$dirname" "$dirname.tar" "$dirname.tar.gz"
do
    if [ -e "$item" ]
    then
	echo "Sorry, $item exists, and I need it not to." >&2
	echo "Please remove it or update your Version file to proceed." >&2
	exit 1
    fi
done
# let the user know what the settings came up with:
echo "Creating export of $name version $version (CVS: $cvsvers)"
# export, and if that fails, bail.
cvs export -d "$dirname" -r "$cvsvers" $localpath || exit 1
for file in `cat NOEXPORT`
do
    (set -x; rm -rf "$dirname"/"$file")
done
# then tar and gzip:
tar cvf "$dirname.tar" "$dirname"
gzip -9fv "$dirname.tar"
 
     |