1999-07-23 00:10:16 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-07-23 13:02:45 +04:00
|
|
|
# $NetBSD: makesums,v 1.4 2002/07/23 09:02:45 lukem Exp $
|
1999-07-23 00:10:16 +04:00
|
|
|
#
|
2000-08-20 12:29:59 +04:00
|
|
|
# Make checksum files for files in ``tardir''. Usage:
|
|
|
|
# makesums [-t tardir] [ -all ] [setname ...]
|
|
|
|
#
|
|
|
|
# If -t is omitted, RELEASEDIR must be set and not empty.
|
|
|
|
# The ``setname'' arguments comprise a list of files to checksum,
|
|
|
|
# and may be omitted (in which case ``*.tgz'' is used).
|
|
|
|
# If -all is given, then the list of sets is ignored, and ``*'' is used.
|
|
|
|
#
|
|
|
|
# After shell glob expansion, the list of sets is filtered to remove known
|
|
|
|
# output file names (of the form *SUM and MD5), non-existent files, and
|
|
|
|
# subdirectories. If this filtering leaves no files, then no output files are
|
|
|
|
# produced. Otherwise the resulting list of files are checksummed and four
|
|
|
|
# output files (BSDSUM, CKSUM, MD5, SYSVSUM) are produced.
|
1999-07-23 00:10:16 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
# set defaults
|
2002-03-31 19:17:58 +04:00
|
|
|
: ${CKSUM=cksum}
|
1999-07-23 00:10:16 +04:00
|
|
|
tars=$RELEASEDIR
|
2000-08-20 12:29:59 +04:00
|
|
|
dash_all=no
|
1999-07-23 00:10:16 +04:00
|
|
|
|
|
|
|
# handle args
|
|
|
|
while : ; do
|
|
|
|
case $1 in
|
2000-08-20 12:29:59 +04:00
|
|
|
-all)
|
|
|
|
dash_all=yes
|
|
|
|
break
|
|
|
|
;;
|
1999-07-23 00:10:16 +04:00
|
|
|
-t*)
|
|
|
|
tars=$2; shift
|
|
|
|
;;
|
|
|
|
-*)
|
|
|
|
cat 1>&2 <<USAGE
|
2000-08-20 12:29:59 +04:00
|
|
|
Usage: $0 [-t tars] [-all] [setname ...]
|
1999-07-23 00:10:16 +04:00
|
|
|
-t tars \$RELEASEDIR [$tars]
|
|
|
|
[setname ...] sets to checksum [*.tgz]
|
2000-08-20 12:29:59 +04:00
|
|
|
-all do all plain files instead of [setname ...]
|
1999-07-23 00:10:16 +04:00
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$tars" ]; then
|
|
|
|
echo \$RELEASEDIR must be set
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $tars
|
2000-08-20 12:29:59 +04:00
|
|
|
pat="$*"
|
|
|
|
if [ $dash_all = yes ]; then
|
|
|
|
pat='*'
|
|
|
|
elif [ -z "$pat" ]; then
|
|
|
|
pat='*.tgz'
|
|
|
|
fi
|
|
|
|
lists=`find $pat -prune -type f \! -name '*SUM' \! -name MD5 2>/dev/null`
|
|
|
|
if [ -n "$lists" ]; then
|
2002-03-31 19:17:58 +04:00
|
|
|
${CKSUM} -o1 $lists > BSDSUM
|
|
|
|
${CKSUM} $lists > CKSUM
|
|
|
|
${CKSUM} -m $lists > MD5
|
|
|
|
${CKSUM} -o2 $lists > SYSVSUM
|
1999-07-23 00:10:16 +04:00
|
|
|
fi
|