makesums revision 1.2 1 1.1 is #!/bin/sh
2 1.1 is #
3 1.2 toddpw # $NetBSD: makesums,v 1.2 2000/08/20 08:29:59 toddpw 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.2 toddpw : ${MAKE=make} # XXX: what purpose does this serve??
22 1.1 is tars=$RELEASEDIR
23 1.2 toddpw dash_all=no
24 1.1 is
25 1.1 is # handle args
26 1.1 is while : ; do
27 1.1 is case $1 in
28 1.2 toddpw -all)
29 1.2 toddpw dash_all=yes
30 1.2 toddpw break
31 1.2 toddpw ;;
32 1.1 is -t*)
33 1.1 is tars=$2; shift
34 1.1 is ;;
35 1.1 is -*)
36 1.1 is cat 1>&2 <<USAGE
37 1.2 toddpw Usage: $0 [-t tars] [-all] [setname ...]
38 1.1 is -t tars \$RELEASEDIR [$tars]
39 1.1 is [setname ...] sets to checksum [*.tgz]
40 1.2 toddpw -all do all plain files instead of [setname ...]
41 1.1 is USAGE
42 1.1 is exit 1
43 1.1 is ;;
44 1.1 is *)
45 1.1 is break
46 1.1 is ;;
47 1.1 is esac
48 1.1 is shift
49 1.1 is done
50 1.1 is
51 1.1 is if [ -z "$tars" ]; then
52 1.1 is echo \$RELEASEDIR must be set
53 1.1 is exit 1
54 1.1 is fi
55 1.1 is
56 1.1 is cd $tars
57 1.2 toddpw pat="$*"
58 1.2 toddpw if [ $dash_all = yes ]; then
59 1.2 toddpw pat='*'
60 1.2 toddpw elif [ -z "$pat" ]; then
61 1.2 toddpw pat='*.tgz'
62 1.2 toddpw fi
63 1.2 toddpw lists=`find $pat -prune -type f \! -name '*SUM' \! -name MD5 2>/dev/null`
64 1.2 toddpw if [ -n "$lists" ]; then
65 1.2 toddpw cksum -o1 $lists > BSDSUM
66 1.2 toddpw cksum $lists > CKSUM
67 1.2 toddpw cksum -m $lists > MD5
68 1.2 toddpw cksum -o2 $lists > SYSVSUM
69 1.1 is fi
70