#!/bin/csh -f

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

set cfpath = `pwd`
set version = ( `/bin/cat $cfpath/../version` )

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

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

  echo Nope

endif

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

echo Making tmp directory...$version

mkdir ~/$version

cd ~/comp/GNU-cfengine

echo Copying files in `pwd`

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

cd ~

(cd $version; chmod 755 * .; chmod 644 VERSION.DIFF COPYING version)
(cd $version/inputs; chmod 644 * )
(cd $version/src; chmod 644 * )
(cd $version/bin; chmod 644 *; chmod 755 mkinstalldirs MakeDist)

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


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