#!/bin/sh

#
# This script is for generating a distribution tar file for the
# Truss Solver html manual.
#
#  also makes a .zip file for Windows use
#
# It relies on the VERSION line in index.htm
# do not reformat these files!!!!
#

####### PROJECT name

PROJECT=truss-html

####### Version

VER=`cat index.htm | grep VERSION | sed -e "s/[^0-9.]//g"`

if [ -z "$VER" ]; then
	echo VERSION not found
	exit 1
fi

echo Making tar file for version $VER


if [ -d $PROJECT-$VER ]; then
	echo Target directory already exists
	exit 1
fi


mkdir $PROJECT-$VER
	
cp *.htm $PROJECT-$VER/.
cp *.gif $PROJECT-$VER/.
cd $PROJECT-$VER
ln -s index.htm index.html
cd ..
cp mktar $PROJECT-$VER/.
cp COPYING $PROJECT-$VER/.
tar cf $PROJECT-$VER.tar $PROJECT-$VER
gzip $PROJECT-$VER.tar
rm -rf $PROJECT-$VER

echo file $PROJECT-$VER.tar.gz created

# make the zip file

ZIP=`which zip | grep / ` 
if [ -n "$ZIP" ]; then 
 echo *.htm *.gif COPYING | zip $PROJECT-$VER -@
 echo Zip file created
else
 echo zip not available
fi
