#!/bin/csh -f

# This is mainly for me and my sun workstation.
# Since I am not encouraging anyone to make their own distributions
# this lack of generality doesn't bother me.

set cfpath = ~/comp/GNU-cfengine
set version = ( `/bin/cat $cfpath/version` )

echo "Did you remember to build the .ps dox??????"

if ( ! -f $cfpath/doc/cfengine.ps ) then

  echo Nope

endif

(cd $cfpath; find -name '*~' -exec rm -f {} \;)

echo Making tmp directory...$version

mkdir ~/$version

cd $cfpath

echo Copying files in `pwd`

tar cf - . | ( cd ~/$version; tar xvf - )

cd ~

(cd $version; chmod 755 * .; chmod 644 VERSION.DIFF acconfig.h version Makefile.in README configure.in; rm -f CFENGINE-TO-DO )
(cd $version/inputs; chmod 644 * )
(cd $version/src; chmod 644 * ; rm .nfs* )
(cd $version/bin; chmod 644 *; chmod 755 mkinstalldirs MakeDist)
(cd $version/pub; chmod 644 *)
(cd $version/contrib; chmod 644 *; )
(cd $version/doc; chmod 644 * )

tar zcf $version.tar.gz $version
rm -r $version


echo New distribution is $version.tar.gz in ~
