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