#!/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
export PATH

if cat / >/dev/null 2>&1
then
	# dirs are readable, so find them
	defopts="\( -type f -o -type d \) -print"
else
	# else restrict to normal files
	defopts="-type f -print"
fi
summer="| xargs sha1sum"
conf=/var/local/security/fp.list

while [ -n "$1" ]
do
	case "$1" in
	-l)
		summer=""
		;;
	-C)
		shift
		if [ -n "$1" -a -r "$1" ]
		then
			conf="$1"
		else
			echo "-C needs a file argument"
			exit 1
		fi
		;;
	*)
		echo "usage: $0 [-l] [-C config]"
		echo "	-l	list files to checksum, but don't checksum"
		echo "	-C	specify alternate configuration file (default $conf)"
		echo "		listing directory/file names followed by find(1) options"
		exit 1
		;;
	esac
	shift
done

cat "$conf" | while read arg
do
	eval "find $arg $defopts $summer"
done
