#!/bin/sh

VERSION=$1

if [ ! -f liblunar-gtk-$VERSION.tar.gz ]; then
	echo "ERROR: liblunar-gtk-$VERSION.tar.gz does not exist..."
	exit 1
fi

echo ""

echo "Checking liblunar-gtk-$VERSION.tar.gz..."
tar xfz liblunar-gtk-$VERSION.tar.gz


for file in NEWS README 
do
	echo -n "$file... "
	if [ "x`grep $VERSION liblunar-gtk-$VERSION/$file | wc -l | awk -F' ' '{print $1}'`" = "x0" ]; then
		echo "failed."
		#exit 1
	else
		echo "ok"
	fi
done

echo -n "INSTALL..."
if [ "x`grep $VERSION liblunar-gtk-$VERSION/INSTALL | wc -l | awk -F' ' '{print $1}'`" = "x2" ]; then 
	echo "ok" 
else
	echo "failed."
	exit 1
fi

echo ""
echo "Number of lines in created documentation files:"

LC_ALL=C wc -l liblunar-gtk-$VERSION/docs/reference/html/*.html | grep total 

rm -rf liblunar-gtk-$VERSION
