#!/bin/sh
# quake 2 tarball release script

# you need to have already tagged the tree with version_x_y

# this is tuned to my working directory...

if [ -z "$1" ]; then
	echo usage: q2rel tag
	echo tag is something like version_0_1 for version 0.1
	echo you should have already tagged the repository, as
	echo this script is going to cvs export from that tag
	exit 1
fi

# this script is prone to err, tell me what's happening
set -x

cd ~/src/quake2/old

chmod -R u+w export
rm -rf export

mkdir export

cd export

cvs -d :ext:zuul:/project/cvs export -r $1 quake2

cd ../cvs

cvs2cl -S --no-wrap

cd ../export/quake2

cp ../../cvs/ChangeLog .

make distcheck

VERSION=`echo $1 | sed -e 's/version_//' -e 's/_/./g'`

cp quake2-$VERSION.tar.gz ../../release
cp quake2-$VERSION.tar.bz2 ../../release
cp quake2-$VERSION.zip ../../release

cd ../../release

md5sum quake2-$VERSION.* | grep -v 'release' | tee quake2-$VERSION.release

scp quake2-$VERSION.* zuul:/home/anonftp/quake2forge

pwd
