#!/bin/sh set -e case $# in 3) CVSMODULE=$1 TAGOPT=-r CVSTAG=$2 TARFILE=$3 ;; 4) CVSMODULE=$1 TAGOPT=$2 CVSTAG=$3 TARFILE=$4 ;; *) echo "usage: cvstotgz cvs-module ([-r] cvs-tag | -D date) cvs-tag tar-file" echo " e.g. cvstotgz frobble V2-1 frobble-2.1.tgz" exit 1 ;; esac TMPDIR=/tmp STEM=`basename $TARFILE .tgz` EXPORTDIR="${TMPDIR}/${STEM}" TMPTAR="${TMPDIR}/cvstotgz.$$.tgz" pushd $TMPDIR cvs export $TAGOPT $CVSTAG -d $STEM $CVSMODULE tar czf $TMPTAR $STEM rm -r $STEM popd mv $TMPTAR $TARFILE