#!/bin/sh 

MANIFEST=.manifest_md5sum
LIST=.list_md5sum

if [ -z "$1" ]; then
    echo "usage: $0 <package-dir>" 1>&2
	exit 1
fi


cd $1
rm -f $LIST

for filename in `ls | sort`; 
	do (md5sum $filename >>$LIST) ; 
done

if [ ! -r "$MANIFEST" ]; then
	echo "$MANIFEST is missing !!!!"
	exit 1
fi

if [ -z "`diff -Nur "$MANIFEST" "$LIST"`" ]; then
	echo "FreeRunner package is fine"
else
	echo "FreeRunner package is borken"
	diff -Nur "$MANIFEST" "$LIST"
fi
