#!/bin/sh -e

#dir=/com/share/ftp/gnu/libc

CVSROOT=/afs/sipb.mit.edu/project/hurddev/cvsroot
export CVSROOT

if [ $# -gt 0 ]; then
  module="$1"; shift
else
  module=hurd
fi

date=`date +%Y%m%d`
snap=${module}-${date}

cvs -Q rtag -F $snap $module

rm -rf $snap
(test $# -eq 0 || cd "$1" || exit
cvs -Q export -d $snap -r $snap $module 1>&2
# afs weirdness makes for funny-looking tar files
chmod -R a+rX $snap
tar -f - -co $snap) | gzip -9 -c > $snap.tar.gz

#find $snap \( -name CVS -prune \) -o \( -type f -print \) |
#xargs ~drepper/bin/md5sum | gzip -9v -c > $snap.md5sum.gz

rm -rf $snap &

#mv -f $snap.tar.gz $snap.md5sum.gz $dir
