makesums revision 1.2
11.1Sis#!/bin/sh 21.1Sis# 31.2Stoddpw# $NetBSD: makesums,v 1.2 2000/08/20 08:29:59 toddpw Exp $ 41.1Sis# 51.2Stoddpw# Make checksum files for files in ``tardir''. Usage: 61.2Stoddpw# makesums [-t tardir] [ -all ] [setname ...] 71.2Stoddpw# 81.2Stoddpw# If -t is omitted, RELEASEDIR must be set and not empty. 91.2Stoddpw# The ``setname'' arguments comprise a list of files to checksum, 101.2Stoddpw# and may be omitted (in which case ``*.tgz'' is used). 111.2Stoddpw# If -all is given, then the list of sets is ignored, and ``*'' is used. 121.2Stoddpw# 131.2Stoddpw# After shell glob expansion, the list of sets is filtered to remove known 141.2Stoddpw# output file names (of the form *SUM and MD5), non-existent files, and 151.2Stoddpw# subdirectories. If this filtering leaves no files, then no output files are 161.2Stoddpw# produced. Otherwise the resulting list of files are checksummed and four 171.2Stoddpw# output files (BSDSUM, CKSUM, MD5, SYSVSUM) are produced. 181.1Sis# 191.1Sis 201.1Sis# set defaults 211.2Stoddpw: ${MAKE=make} # XXX: what purpose does this serve?? 221.1Sistars=$RELEASEDIR 231.2Stoddpwdash_all=no 241.1Sis 251.1Sis# handle args 261.1Siswhile : ; do 271.1Sis case $1 in 281.2Stoddpw -all) 291.2Stoddpw dash_all=yes 301.2Stoddpw break 311.2Stoddpw ;; 321.1Sis -t*) 331.1Sis tars=$2; shift 341.1Sis ;; 351.1Sis -*) 361.1Sis cat 1>&2 <<USAGE 371.2StoddpwUsage: $0 [-t tars] [-all] [setname ...] 381.1Sis -t tars \$RELEASEDIR [$tars] 391.1Sis [setname ...] sets to checksum [*.tgz] 401.2Stoddpw -all do all plain files instead of [setname ...] 411.1SisUSAGE 421.1Sis exit 1 431.1Sis ;; 441.1Sis *) 451.1Sis break 461.1Sis ;; 471.1Sis esac 481.1Sis shift 491.1Sisdone 501.1Sis 511.1Sisif [ -z "$tars" ]; then 521.1Sis echo \$RELEASEDIR must be set 531.1Sis exit 1 541.1Sisfi 551.1Sis 561.1Siscd $tars 571.2Stoddpwpat="$*" 581.2Stoddpwif [ $dash_all = yes ]; then 591.2Stoddpw pat='*' 601.2Stoddpwelif [ -z "$pat" ]; then 611.2Stoddpw pat='*.tgz' 621.2Stoddpwfi 631.2Stoddpwlists=`find $pat -prune -type f \! -name '*SUM' \! -name MD5 2>/dev/null` 641.2Stoddpwif [ -n "$lists" ]; then 651.2Stoddpw cksum -o1 $lists > BSDSUM 661.2Stoddpw cksum $lists > CKSUM 671.2Stoddpw cksum -m $lists > MD5 681.2Stoddpw cksum -o2 $lists > SYSVSUM 691.1Sisfi 70