makesums revision 1.3 1 1.1 is #!/bin/sh
2 1.1 is #
3 1.3 bjh21 # $NetBSD: makesums,v 1.3 2002/03/31 15:17:58 bjh21 Exp $
4 1.1 is #
5 1.2 toddpw # Make checksum files for files in ``tardir''. Usage:
6 1.2 toddpw # makesums [-t tardir] [ -all ] [setname ...]
7 1.2 toddpw #
8 1.2 toddpw # If -t is omitted, RELEASEDIR must be set and not empty.
9 1.2 toddpw # The ``setname'' arguments comprise a list of files to checksum,
10 1.2 toddpw # and may be omitted (in which case ``*.tgz'' is used).
11 1.2 toddpw # If -all is given, then the list of sets is ignored, and ``*'' is used.
12 1.2 toddpw #
13 1.2 toddpw # After shell glob expansion, the list of sets is filtered to remove known
14 1.2 toddpw # output file names (of the form *SUM and MD5), non-existent files, and
15 1.2 toddpw # subdirectories. If this filtering leaves no files, then no output files are
16 1.2 toddpw # produced. Otherwise the resulting list of files are checksummed and four
17 1.2 toddpw # output files (BSDSUM, CKSUM, MD5, SYSVSUM) are produced.
18 1.1 is #
19 1.1 is
20 1.1 is # set defaults
21 1.3 bjh21 : ${CKSUM=cksum}
22 1.2 toddpw : ${MAKE=make} # XXX: what purpose does this serve??
23 1.1 is tars=$RELEASEDIR
24 1.2 toddpw dash_all=no
25 1.1 is
26 1.1 is # handle args
27 1.1 is while : ; do
28 1.1 is case $1 in
29 1.2 toddpw -all)
30 1.2 toddpw dash_all=yes
31 1.2 toddpw break
32 1.2 toddpw ;;
33 1.1 is -t*)
34 1.1 is tars=$2; shift
35 1.1 is ;;
36 1.1 is -*)
37 1.1 is cat 1>&2 <<USAGE
38 1.2 toddpw Usage: $0 [-t tars] [-all] [setname ...]
39 1.1 is -t tars \$RELEASEDIR [$tars]
40 1.1 is [setname ...] sets to checksum [*.tgz]
41 1.2 toddpw -all do all plain files instead of [setname ...]
42 1.1 is USAGE
43 1.1 is exit 1
44 1.1 is ;;
45 1.1 is *)
46 1.1 is break
47 1.1 is ;;
48 1.1 is esac
49 1.1 is shift
50 1.1 is done
51 1.1 is
52 1.1 is if [ -z "$tars" ]; then
53 1.1 is echo \$RELEASEDIR must be set
54 1.1 is exit 1
55 1.1 is fi
56 1.1 is
57 1.1 is cd $tars
58 1.2 toddpw pat="$*"
59 1.2 toddpw if [ $dash_all = yes ]; then
60 1.2 toddpw pat='*'
61 1.2 toddpw elif [ -z "$pat" ]; then
62 1.2 toddpw pat='*.tgz'
63 1.2 toddpw fi
64 1.2 toddpw lists=`find $pat -prune -type f \! -name '*SUM' \! -name MD5 2>/dev/null`
65 1.2 toddpw if [ -n "$lists" ]; then
66 1.3 bjh21 ${CKSUM} -o1 $lists > BSDSUM
67 1.3 bjh21 ${CKSUM} $lists > CKSUM
68 1.3 bjh21 ${CKSUM} -m $lists > MD5
69 1.3 bjh21 ${CKSUM} -o2 $lists > SYSVSUM
70 1.1 is fi
71